Skip to content

Commit c761923

Browse files
committed
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o: "A few bug fixes and add some missing KERN_CONT annotations" * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: add missing KERN_CONT to a few more debugging uses fscrypto: lock inode while setting encryption policy ext4: correct endianness conversion in __xattr_check_inode() fscrypto: make XTS tweak initialization endian-independent ext4: do not advertise encryption support when disabled jbd2: fix incorrect unlock on j_list_lock ext4: super.c: Update logging style using KERN_CONT
2 parents a55da8a + d74f3d2 commit c761923

File tree

9 files changed

+56
-50
lines changed

9 files changed

+56
-50
lines changed

fs/crypto/crypto.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ static int do_page_crypto(struct inode *inode,
151151
struct page *src_page, struct page *dest_page,
152152
gfp_t gfp_flags)
153153
{
154-
u8 xts_tweak[FS_XTS_TWEAK_SIZE];
154+
struct {
155+
__le64 index;
156+
u8 padding[FS_XTS_TWEAK_SIZE - sizeof(__le64)];
157+
} xts_tweak;
155158
struct skcipher_request *req = NULL;
156159
DECLARE_FS_COMPLETION_RESULT(ecr);
157160
struct scatterlist dst, src;
@@ -171,17 +174,15 @@ static int do_page_crypto(struct inode *inode,
171174
req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
172175
page_crypt_complete, &ecr);
173176

174-
BUILD_BUG_ON(FS_XTS_TWEAK_SIZE < sizeof(index));
175-
memcpy(xts_tweak, &index, sizeof(index));
176-
memset(&xts_tweak[sizeof(index)], 0,
177-
FS_XTS_TWEAK_SIZE - sizeof(index));
177+
BUILD_BUG_ON(sizeof(xts_tweak) != FS_XTS_TWEAK_SIZE);
178+
xts_tweak.index = cpu_to_le64(index);
179+
memset(xts_tweak.padding, 0, sizeof(xts_tweak.padding));
178180

179181
sg_init_table(&dst, 1);
180182
sg_set_page(&dst, dest_page, PAGE_SIZE, 0);
181183
sg_init_table(&src, 1);
182184
sg_set_page(&src, src_page, PAGE_SIZE, 0);
183-
skcipher_request_set_crypt(req, &src, &dst, PAGE_SIZE,
184-
xts_tweak);
185+
skcipher_request_set_crypt(req, &src, &dst, PAGE_SIZE, &xts_tweak);
185186
if (rw == FS_DECRYPT)
186187
res = crypto_skcipher_decrypt(req);
187188
else

fs/crypto/policy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ int fscrypt_process_policy(struct file *filp,
109109
if (ret)
110110
return ret;
111111

112+
inode_lock(inode);
113+
112114
if (!inode_has_encryption_context(inode)) {
113115
if (!S_ISDIR(inode->i_mode))
114116
ret = -EINVAL;
@@ -127,6 +129,8 @@ int fscrypt_process_policy(struct file *filp,
127129
ret = -EINVAL;
128130
}
129131

132+
inode_unlock(inode);
133+
130134
mnt_drop_write_file(filp);
131135
return ret;
132136
}

fs/ext4/block_validity.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ static void debug_print_tree(struct ext4_sb_info *sbi)
128128
node = rb_first(&sbi->system_blks);
129129
while (node) {
130130
entry = rb_entry(node, struct ext4_system_zone, node);
131-
printk("%s%llu-%llu", first ? "" : ", ",
131+
printk(KERN_CONT "%s%llu-%llu", first ? "" : ", ",
132132
entry->start_blk, entry->start_blk + entry->count - 1);
133133
first = 0;
134134
node = rb_next(node);
135135
}
136-
printk("\n");
136+
printk(KERN_CONT "\n");
137137
}
138138

139139
int ext4_setup_system_zone(struct super_block *sb)

fs/ext4/mballoc.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@
2727
#ifdef CONFIG_EXT4_DEBUG
2828
extern ushort ext4_mballoc_debug;
2929

30-
#define mb_debug(n, fmt, a...) \
31-
do { \
32-
if ((n) <= ext4_mballoc_debug) { \
33-
printk(KERN_DEBUG "(%s, %d): %s: ", \
34-
__FILE__, __LINE__, __func__); \
35-
printk(fmt, ## a); \
36-
} \
37-
} while (0)
30+
#define mb_debug(n, fmt, ...) \
31+
do { \
32+
if ((n) <= ext4_mballoc_debug) { \
33+
printk(KERN_DEBUG "(%s, %d): %s: " fmt, \
34+
__FILE__, __LINE__, __func__, ##__VA_ARGS__); \
35+
} \
36+
} while (0)
3837
#else
39-
#define mb_debug(n, fmt, a...) no_printk(fmt, ## a)
38+
#define mb_debug(n, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
4039
#endif
4140

4241
#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */

fs/ext4/namei.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,13 @@ static inline unsigned dx_node_limit(struct inode *dir)
577577
static void dx_show_index(char * label, struct dx_entry *entries)
578578
{
579579
int i, n = dx_get_count (entries);
580-
printk(KERN_DEBUG "%s index ", label);
580+
printk(KERN_DEBUG "%s index", label);
581581
for (i = 0; i < n; i++) {
582-
printk("%x->%lu ", i ? dx_get_hash(entries + i) :
583-
0, (unsigned long)dx_get_block(entries + i));
582+
printk(KERN_CONT " %x->%lu",
583+
i ? dx_get_hash(entries + i) : 0,
584+
(unsigned long)dx_get_block(entries + i));
584585
}
585-
printk("\n");
586+
printk(KERN_CONT "\n");
586587
}
587588

588589
struct stats
@@ -679,7 +680,7 @@ static struct stats dx_show_leaf(struct inode *dir,
679680
}
680681
de = ext4_next_entry(de, size);
681682
}
682-
printk("(%i)\n", names);
683+
printk(KERN_CONT "(%i)\n", names);
683684
return (struct stats) { names, space, 1 };
684685
}
685686

@@ -798,7 +799,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
798799
q = entries + count - 1;
799800
while (p <= q) {
800801
m = p + (q - p) / 2;
801-
dxtrace(printk("."));
802+
dxtrace(printk(KERN_CONT "."));
802803
if (dx_get_hash(m) > hash)
803804
q = m - 1;
804805
else
@@ -810,7 +811,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
810811
at = entries;
811812
while (n--)
812813
{
813-
dxtrace(printk(","));
814+
dxtrace(printk(KERN_CONT ","));
814815
if (dx_get_hash(++at) > hash)
815816
{
816817
at--;
@@ -821,7 +822,8 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
821822
}
822823

823824
at = p - 1;
824-
dxtrace(printk(" %x->%u\n", at == entries ? 0 : dx_get_hash(at),
825+
dxtrace(printk(KERN_CONT " %x->%u\n",
826+
at == entries ? 0 : dx_get_hash(at),
825827
dx_get_block(at)));
826828
frame->entries = entries;
827829
frame->at = at;

fs/ext4/super.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -597,14 +597,15 @@ void __ext4_std_error(struct super_block *sb, const char *function,
597597
void __ext4_abort(struct super_block *sb, const char *function,
598598
unsigned int line, const char *fmt, ...)
599599
{
600+
struct va_format vaf;
600601
va_list args;
601602

602603
save_error_info(sb, function, line);
603604
va_start(args, fmt);
604-
printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: ", sb->s_id,
605-
function, line);
606-
vprintk(fmt, args);
607-
printk("\n");
605+
vaf.fmt = fmt;
606+
vaf.va = &args;
607+
printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: %pV\n",
608+
sb->s_id, function, line, &vaf);
608609
va_end(args);
609610

610611
if ((sb->s_flags & MS_RDONLY) == 0) {
@@ -2715,12 +2716,12 @@ static void print_daily_error_info(unsigned long arg)
27152716
es->s_first_error_func,
27162717
le32_to_cpu(es->s_first_error_line));
27172718
if (es->s_first_error_ino)
2718-
printk(": inode %u",
2719+
printk(KERN_CONT ": inode %u",
27192720
le32_to_cpu(es->s_first_error_ino));
27202721
if (es->s_first_error_block)
2721-
printk(": block %llu", (unsigned long long)
2722+
printk(KERN_CONT ": block %llu", (unsigned long long)
27222723
le64_to_cpu(es->s_first_error_block));
2723-
printk("\n");
2724+
printk(KERN_CONT "\n");
27242725
}
27252726
if (es->s_last_error_time) {
27262727
printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d",
@@ -2729,12 +2730,12 @@ static void print_daily_error_info(unsigned long arg)
27292730
es->s_last_error_func,
27302731
le32_to_cpu(es->s_last_error_line));
27312732
if (es->s_last_error_ino)
2732-
printk(": inode %u",
2733+
printk(KERN_CONT ": inode %u",
27332734
le32_to_cpu(es->s_last_error_ino));
27342735
if (es->s_last_error_block)
2735-
printk(": block %llu", (unsigned long long)
2736+
printk(KERN_CONT ": block %llu", (unsigned long long)
27362737
le64_to_cpu(es->s_last_error_block));
2737-
printk("\n");
2738+
printk(KERN_CONT "\n");
27382739
}
27392740
mod_timer(&sbi->s_err_report, jiffies + 24*60*60*HZ); /* Once a day */
27402741
}

fs/ext4/sysfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,18 @@ static struct attribute *ext4_attrs[] = {
223223
EXT4_ATTR_FEATURE(lazy_itable_init);
224224
EXT4_ATTR_FEATURE(batched_discard);
225225
EXT4_ATTR_FEATURE(meta_bg_resize);
226+
#ifdef CONFIG_EXT4_FS_ENCRYPTION
226227
EXT4_ATTR_FEATURE(encryption);
228+
#endif
227229
EXT4_ATTR_FEATURE(metadata_csum_seed);
228230

229231
static struct attribute *ext4_feat_attrs[] = {
230232
ATTR_LIST(lazy_itable_init),
231233
ATTR_LIST(batched_discard),
232234
ATTR_LIST(meta_bg_resize),
235+
#ifdef CONFIG_EXT4_FS_ENCRYPTION
233236
ATTR_LIST(encryption),
237+
#endif
234238
ATTR_LIST(metadata_csum_seed),
235239
NULL,
236240
};

fs/ext4/xattr.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,12 @@
6161
#include "acl.h"
6262

6363
#ifdef EXT4_XATTR_DEBUG
64-
# define ea_idebug(inode, f...) do { \
65-
printk(KERN_DEBUG "inode %s:%lu: ", \
66-
inode->i_sb->s_id, inode->i_ino); \
67-
printk(f); \
68-
printk("\n"); \
69-
} while (0)
70-
# define ea_bdebug(bh, f...) do { \
71-
printk(KERN_DEBUG "block %pg:%lu: ", \
72-
bh->b_bdev, (unsigned long) bh->b_blocknr); \
73-
printk(f); \
74-
printk("\n"); \
75-
} while (0)
64+
# define ea_idebug(inode, fmt, ...) \
65+
printk(KERN_DEBUG "inode %s:%lu: " fmt "\n", \
66+
inode->i_sb->s_id, inode->i_ino, ##__VA_ARGS__)
67+
# define ea_bdebug(bh, fmt, ...) \
68+
printk(KERN_DEBUG "block %pg:%lu: " fmt "\n", \
69+
bh->b_bdev, (unsigned long)bh->b_blocknr, ##__VA_ARGS__)
7670
#else
7771
# define ea_idebug(inode, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
7872
# define ea_bdebug(bh, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
@@ -241,7 +235,7 @@ __xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header,
241235
int error = -EFSCORRUPTED;
242236

243237
if (((void *) header >= end) ||
244-
(header->h_magic != le32_to_cpu(EXT4_XATTR_MAGIC)))
238+
(header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)))
245239
goto errout;
246240
error = ext4_xattr_check_names(entry, end, entry);
247241
errout:

fs/jbd2/transaction.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,15 +1149,16 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
11491149
JBUFFER_TRACE(jh, "file as BJ_Reserved");
11501150
spin_lock(&journal->j_list_lock);
11511151
__jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
1152+
spin_unlock(&journal->j_list_lock);
11521153
} else if (jh->b_transaction == journal->j_committing_transaction) {
11531154
/* first access by this transaction */
11541155
jh->b_modified = 0;
11551156

11561157
JBUFFER_TRACE(jh, "set next transaction");
11571158
spin_lock(&journal->j_list_lock);
11581159
jh->b_next_transaction = transaction;
1160+
spin_unlock(&journal->j_list_lock);
11591161
}
1160-
spin_unlock(&journal->j_list_lock);
11611162
jbd_unlock_bh_state(bh);
11621163

11631164
/*

0 commit comments

Comments
 (0)