aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-23 19:52:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-23 19:52:19 -0400
commitc761923cb80700cf8d907377e374d21b08c0ff77 (patch)
treef4361977e125c3a47cdf801596cab6d37aa2959f
parenta55da8a0ddac4ebe0d7b3a1e5902cb1d286f8062 (diff)
parentd74f3d25289aa9722cf777a7482eeee2eacdf46e (diff)
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
-rw-r--r--fs/crypto/crypto.c15
-rw-r--r--fs/crypto/policy.c4
-rw-r--r--fs/ext4/block_validity.c4
-rw-r--r--fs/ext4/mballoc.h17
-rw-r--r--fs/ext4/namei.c18
-rw-r--r--fs/ext4/super.c21
-rw-r--r--fs/ext4/sysfs.c4
-rw-r--r--fs/ext4/xattr.c20
-rw-r--r--fs/jbd2/transaction.c3
9 files changed, 56 insertions, 50 deletions
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
index 61057b7dbddb..98f87fe8f186 100644
--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -151,7 +151,10 @@ static int do_page_crypto(struct inode *inode,
151 struct page *src_page, struct page *dest_page, 151 struct page *src_page, struct page *dest_page,
152 gfp_t gfp_flags) 152 gfp_t gfp_flags)
153{ 153{
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;
155 struct skcipher_request *req = NULL; 158 struct skcipher_request *req = NULL;
156 DECLARE_FS_COMPLETION_RESULT(ecr); 159 DECLARE_FS_COMPLETION_RESULT(ecr);
157 struct scatterlist dst, src; 160 struct scatterlist dst, src;
@@ -171,17 +174,15 @@ static int do_page_crypto(struct inode *inode,
171 req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, 174 req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
172 page_crypt_complete, &ecr); 175 page_crypt_complete, &ecr);
173 176
174 BUILD_BUG_ON(FS_XTS_TWEAK_SIZE < sizeof(index)); 177 BUILD_BUG_ON(sizeof(xts_tweak) != FS_XTS_TWEAK_SIZE);
175 memcpy(xts_tweak, &index, sizeof(index)); 178 xts_tweak.index = cpu_to_le64(index);
176 memset(&xts_tweak[sizeof(index)], 0, 179 memset(xts_tweak.padding, 0, sizeof(xts_tweak.padding));
177 FS_XTS_TWEAK_SIZE - sizeof(index));
178 180
179 sg_init_table(&dst, 1); 181 sg_init_table(&dst, 1);
180 sg_set_page(&dst, dest_page, PAGE_SIZE, 0); 182 sg_set_page(&dst, dest_page, PAGE_SIZE, 0);
181 sg_init_table(&src, 1); 183 sg_init_table(&src, 1);
182 sg_set_page(&src, src_page, PAGE_SIZE, 0); 184 sg_set_page(&src, src_page, PAGE_SIZE, 0);
183 skcipher_request_set_crypt(req, &src, &dst, PAGE_SIZE, 185 skcipher_request_set_crypt(req, &src, &dst, PAGE_SIZE, &xts_tweak);
184 xts_tweak);
185 if (rw == FS_DECRYPT) 186 if (rw == FS_DECRYPT)
186 res = crypto_skcipher_decrypt(req); 187 res = crypto_skcipher_decrypt(req);
187 else 188 else
diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c
index ed115acb5dee..6865663aac69 100644
--- a/fs/crypto/policy.c
+++ b/fs/crypto/policy.c
@@ -109,6 +109,8 @@ int fscrypt_process_policy(struct file *filp,
109 if (ret) 109 if (ret)
110 return ret; 110 return ret;
111 111
112 inode_lock(inode);
113
112 if (!inode_has_encryption_context(inode)) { 114 if (!inode_has_encryption_context(inode)) {
113 if (!S_ISDIR(inode->i_mode)) 115 if (!S_ISDIR(inode->i_mode))
114 ret = -EINVAL; 116 ret = -EINVAL;
@@ -127,6 +129,8 @@ int fscrypt_process_policy(struct file *filp,
127 ret = -EINVAL; 129 ret = -EINVAL;
128 } 130 }
129 131
132 inode_unlock(inode);
133
130 mnt_drop_write_file(filp); 134 mnt_drop_write_file(filp);
131 return ret; 135 return ret;
132} 136}
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 02ddec6d8a7d..fdb19543af1e 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -128,12 +128,12 @@ static void debug_print_tree(struct ext4_sb_info *sbi)
128 node = rb_first(&sbi->system_blks); 128 node = rb_first(&sbi->system_blks);
129 while (node) { 129 while (node) {
130 entry = rb_entry(node, struct ext4_system_zone, node); 130 entry = rb_entry(node, struct ext4_system_zone, node);
131 printk("%s%llu-%llu", first ? "" : ", ", 131 printk(KERN_CONT "%s%llu-%llu", first ? "" : ", ",
132 entry->start_blk, entry->start_blk + entry->count - 1); 132 entry->start_blk, entry->start_blk + entry->count - 1);
133 first = 0; 133 first = 0;
134 node = rb_next(node); 134 node = rb_next(node);
135 } 135 }
136 printk("\n"); 136 printk(KERN_CONT "\n");
137} 137}
138 138
139int ext4_setup_system_zone(struct super_block *sb) 139int ext4_setup_system_zone(struct super_block *sb)
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 3ef1df6ae9ec..1aba469f8220 100644
--- a/fs/ext4/mballoc.h
+++ b/fs/ext4/mballoc.h
@@ -27,16 +27,15 @@
27#ifdef CONFIG_EXT4_DEBUG 27#ifdef CONFIG_EXT4_DEBUG
28extern ushort ext4_mballoc_debug; 28extern ushort ext4_mballoc_debug;
29 29
30#define mb_debug(n, fmt, a...) \ 30#define mb_debug(n, fmt, ...) \
31 do { \ 31do { \
32 if ((n) <= ext4_mballoc_debug) { \ 32 if ((n) <= ext4_mballoc_debug) { \
33 printk(KERN_DEBUG "(%s, %d): %s: ", \ 33 printk(KERN_DEBUG "(%s, %d): %s: " fmt, \
34 __FILE__, __LINE__, __func__); \ 34 __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
35 printk(fmt, ## a); \ 35 } \
36 } \ 36} while (0)
37 } while (0)
38#else 37#else
39#define mb_debug(n, fmt, a...) no_printk(fmt, ## a) 38#define mb_debug(n, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
40#endif 39#endif
41 40
42#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */ 41#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index f92f10d4f66a..104f8bfba718 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -577,12 +577,13 @@ static inline unsigned dx_node_limit(struct inode *dir)
577static void dx_show_index(char * label, struct dx_entry *entries) 577static void dx_show_index(char * label, struct dx_entry *entries)
578{ 578{
579 int i, n = dx_get_count (entries); 579 int i, n = dx_get_count (entries);
580 printk(KERN_DEBUG "%s index ", label); 580 printk(KERN_DEBUG "%s index", label);
581 for (i = 0; i < n; i++) { 581 for (i = 0; i < n; i++) {
582 printk("%x->%lu ", i ? dx_get_hash(entries + i) : 582 printk(KERN_CONT " %x->%lu",
583 0, (unsigned long)dx_get_block(entries + i)); 583 i ? dx_get_hash(entries + i) : 0,
584 (unsigned long)dx_get_block(entries + i));
584 } 585 }
585 printk("\n"); 586 printk(KERN_CONT "\n");
586} 587}
587 588
588struct stats 589struct stats
@@ -679,7 +680,7 @@ static struct stats dx_show_leaf(struct inode *dir,
679 } 680 }
680 de = ext4_next_entry(de, size); 681 de = ext4_next_entry(de, size);
681 } 682 }
682 printk("(%i)\n", names); 683 printk(KERN_CONT "(%i)\n", names);
683 return (struct stats) { names, space, 1 }; 684 return (struct stats) { names, space, 1 };
684} 685}
685 686
@@ -798,7 +799,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
798 q = entries + count - 1; 799 q = entries + count - 1;
799 while (p <= q) { 800 while (p <= q) {
800 m = p + (q - p) / 2; 801 m = p + (q - p) / 2;
801 dxtrace(printk(".")); 802 dxtrace(printk(KERN_CONT "."));
802 if (dx_get_hash(m) > hash) 803 if (dx_get_hash(m) > hash)
803 q = m - 1; 804 q = m - 1;
804 else 805 else
@@ -810,7 +811,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
810 at = entries; 811 at = entries;
811 while (n--) 812 while (n--)
812 { 813 {
813 dxtrace(printk(",")); 814 dxtrace(printk(KERN_CONT ","));
814 if (dx_get_hash(++at) > hash) 815 if (dx_get_hash(++at) > hash)
815 { 816 {
816 at--; 817 at--;
@@ -821,7 +822,8 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
821 } 822 }
822 823
823 at = p - 1; 824 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),
825 dx_get_block(at))); 827 dx_get_block(at)));
826 frame->entries = entries; 828 frame->entries = entries;
827 frame->at = at; 829 frame->at = at;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6db81fbcbaa6..20da99da0a34 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -597,14 +597,15 @@ void __ext4_std_error(struct super_block *sb, const char *function,
597void __ext4_abort(struct super_block *sb, const char *function, 597void __ext4_abort(struct super_block *sb, const char *function,
598 unsigned int line, const char *fmt, ...) 598 unsigned int line, const char *fmt, ...)
599{ 599{
600 struct va_format vaf;
600 va_list args; 601 va_list args;
601 602
602 save_error_info(sb, function, line); 603 save_error_info(sb, function, line);
603 va_start(args, fmt); 604 va_start(args, fmt);
604 printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: ", sb->s_id, 605 vaf.fmt = fmt;
605 function, line); 606 vaf.va = &args;
606 vprintk(fmt, args); 607 printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: %pV\n",
607 printk("\n"); 608 sb->s_id, function, line, &vaf);
608 va_end(args); 609 va_end(args);
609 610
610 if ((sb->s_flags & MS_RDONLY) == 0) { 611 if ((sb->s_flags & MS_RDONLY) == 0) {
@@ -2715,12 +2716,12 @@ static void print_daily_error_info(unsigned long arg)
2715 es->s_first_error_func, 2716 es->s_first_error_func,
2716 le32_to_cpu(es->s_first_error_line)); 2717 le32_to_cpu(es->s_first_error_line));
2717 if (es->s_first_error_ino) 2718 if (es->s_first_error_ino)
2718 printk(": inode %u", 2719 printk(KERN_CONT ": inode %u",
2719 le32_to_cpu(es->s_first_error_ino)); 2720 le32_to_cpu(es->s_first_error_ino));
2720 if (es->s_first_error_block) 2721 if (es->s_first_error_block)
2721 printk(": block %llu", (unsigned long long) 2722 printk(KERN_CONT ": block %llu", (unsigned long long)
2722 le64_to_cpu(es->s_first_error_block)); 2723 le64_to_cpu(es->s_first_error_block));
2723 printk("\n"); 2724 printk(KERN_CONT "\n");
2724 } 2725 }
2725 if (es->s_last_error_time) { 2726 if (es->s_last_error_time) {
2726 printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d", 2727 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)
2729 es->s_last_error_func, 2730 es->s_last_error_func,
2730 le32_to_cpu(es->s_last_error_line)); 2731 le32_to_cpu(es->s_last_error_line));
2731 if (es->s_last_error_ino) 2732 if (es->s_last_error_ino)
2732 printk(": inode %u", 2733 printk(KERN_CONT ": inode %u",
2733 le32_to_cpu(es->s_last_error_ino)); 2734 le32_to_cpu(es->s_last_error_ino));
2734 if (es->s_last_error_block) 2735 if (es->s_last_error_block)
2735 printk(": block %llu", (unsigned long long) 2736 printk(KERN_CONT ": block %llu", (unsigned long long)
2736 le64_to_cpu(es->s_last_error_block)); 2737 le64_to_cpu(es->s_last_error_block));
2737 printk("\n"); 2738 printk(KERN_CONT "\n");
2738 } 2739 }
2739 mod_timer(&sbi->s_err_report, jiffies + 24*60*60*HZ); /* Once a day */ 2740 mod_timer(&sbi->s_err_report, jiffies + 24*60*60*HZ); /* Once a day */
2740} 2741}
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index 73bcfd41f5f2..42145be5c6b4 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -223,14 +223,18 @@ static struct attribute *ext4_attrs[] = {
223EXT4_ATTR_FEATURE(lazy_itable_init); 223EXT4_ATTR_FEATURE(lazy_itable_init);
224EXT4_ATTR_FEATURE(batched_discard); 224EXT4_ATTR_FEATURE(batched_discard);
225EXT4_ATTR_FEATURE(meta_bg_resize); 225EXT4_ATTR_FEATURE(meta_bg_resize);
226#ifdef CONFIG_EXT4_FS_ENCRYPTION
226EXT4_ATTR_FEATURE(encryption); 227EXT4_ATTR_FEATURE(encryption);
228#endif
227EXT4_ATTR_FEATURE(metadata_csum_seed); 229EXT4_ATTR_FEATURE(metadata_csum_seed);
228 230
229static struct attribute *ext4_feat_attrs[] = { 231static struct attribute *ext4_feat_attrs[] = {
230 ATTR_LIST(lazy_itable_init), 232 ATTR_LIST(lazy_itable_init),
231 ATTR_LIST(batched_discard), 233 ATTR_LIST(batched_discard),
232 ATTR_LIST(meta_bg_resize), 234 ATTR_LIST(meta_bg_resize),
235#ifdef CONFIG_EXT4_FS_ENCRYPTION
233 ATTR_LIST(encryption), 236 ATTR_LIST(encryption),
237#endif
234 ATTR_LIST(metadata_csum_seed), 238 ATTR_LIST(metadata_csum_seed),
235 NULL, 239 NULL,
236}; 240};
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index c15d63389957..d77be9e9f535 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -61,18 +61,12 @@
61#include "acl.h" 61#include "acl.h"
62 62
63#ifdef EXT4_XATTR_DEBUG 63#ifdef EXT4_XATTR_DEBUG
64# define ea_idebug(inode, f...) do { \ 64# define ea_idebug(inode, fmt, ...) \
65 printk(KERN_DEBUG "inode %s:%lu: ", \ 65 printk(KERN_DEBUG "inode %s:%lu: " fmt "\n", \
66 inode->i_sb->s_id, inode->i_ino); \ 66 inode->i_sb->s_id, inode->i_ino, ##__VA_ARGS__)
67 printk(f); \ 67# define ea_bdebug(bh, fmt, ...) \
68 printk("\n"); \ 68 printk(KERN_DEBUG "block %pg:%lu: " fmt "\n", \
69 } while (0) 69 bh->b_bdev, (unsigned long)bh->b_blocknr, ##__VA_ARGS__)
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)
76#else 70#else
77# define ea_idebug(inode, fmt, ...) no_printk(fmt, ##__VA_ARGS__) 71# define ea_idebug(inode, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
78# define ea_bdebug(bh, fmt, ...) no_printk(fmt, ##__VA_ARGS__) 72# 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,
241 int error = -EFSCORRUPTED; 235 int error = -EFSCORRUPTED;
242 236
243 if (((void *) header >= end) || 237 if (((void *) header >= end) ||
244 (header->h_magic != le32_to_cpu(EXT4_XATTR_MAGIC))) 238 (header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)))
245 goto errout; 239 goto errout;
246 error = ext4_xattr_check_names(entry, end, entry); 240 error = ext4_xattr_check_names(entry, end, entry);
247errout: 241errout:
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 3d8246a9faa4..e1652665bd93 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1149,6 +1149,7 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
1149 JBUFFER_TRACE(jh, "file as BJ_Reserved"); 1149 JBUFFER_TRACE(jh, "file as BJ_Reserved");
1150 spin_lock(&journal->j_list_lock); 1150 spin_lock(&journal->j_list_lock);
1151 __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); 1151 __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
1152 spin_unlock(&journal->j_list_lock);
1152 } else if (jh->b_transaction == journal->j_committing_transaction) { 1153 } else if (jh->b_transaction == journal->j_committing_transaction) {
1153 /* first access by this transaction */ 1154 /* first access by this transaction */
1154 jh->b_modified = 0; 1155 jh->b_modified = 0;
@@ -1156,8 +1157,8 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
1156 JBUFFER_TRACE(jh, "set next transaction"); 1157 JBUFFER_TRACE(jh, "set next transaction");
1157 spin_lock(&journal->j_list_lock); 1158 spin_lock(&journal->j_list_lock);
1158 jh->b_next_transaction = transaction; 1159 jh->b_next_transaction = transaction;
1160 spin_unlock(&journal->j_list_lock);
1159 } 1161 }
1160 spin_unlock(&journal->j_list_lock);
1161 jbd_unlock_bh_state(bh); 1162 jbd_unlock_bh_state(bh);
1162 1163
1163 /* 1164 /*