Commit c761923c authored by Linus Torvalds's avatar Linus Torvalds

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
parents a55da8a0 d74f3d25
...@@ -151,7 +151,10 @@ static int do_page_crypto(struct inode *inode, ...@@ -151,7 +151,10 @@ static int do_page_crypto(struct inode *inode,
struct page *src_page, struct page *dest_page, struct page *src_page, struct page *dest_page,
gfp_t gfp_flags) gfp_t gfp_flags)
{ {
u8 xts_tweak[FS_XTS_TWEAK_SIZE]; struct {
__le64 index;
u8 padding[FS_XTS_TWEAK_SIZE - sizeof(__le64)];
} xts_tweak;
struct skcipher_request *req = NULL; struct skcipher_request *req = NULL;
DECLARE_FS_COMPLETION_RESULT(ecr); DECLARE_FS_COMPLETION_RESULT(ecr);
struct scatterlist dst, src; struct scatterlist dst, src;
...@@ -171,17 +174,15 @@ static int do_page_crypto(struct inode *inode, ...@@ -171,17 +174,15 @@ static int do_page_crypto(struct inode *inode,
req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
page_crypt_complete, &ecr); page_crypt_complete, &ecr);
BUILD_BUG_ON(FS_XTS_TWEAK_SIZE < sizeof(index)); BUILD_BUG_ON(sizeof(xts_tweak) != FS_XTS_TWEAK_SIZE);
memcpy(xts_tweak, &index, sizeof(index)); xts_tweak.index = cpu_to_le64(index);
memset(&xts_tweak[sizeof(index)], 0, memset(xts_tweak.padding, 0, sizeof(xts_tweak.padding));
FS_XTS_TWEAK_SIZE - sizeof(index));
sg_init_table(&dst, 1); sg_init_table(&dst, 1);
sg_set_page(&dst, dest_page, PAGE_SIZE, 0); sg_set_page(&dst, dest_page, PAGE_SIZE, 0);
sg_init_table(&src, 1); sg_init_table(&src, 1);
sg_set_page(&src, src_page, PAGE_SIZE, 0); sg_set_page(&src, src_page, PAGE_SIZE, 0);
skcipher_request_set_crypt(req, &src, &dst, PAGE_SIZE, skcipher_request_set_crypt(req, &src, &dst, PAGE_SIZE, &xts_tweak);
xts_tweak);
if (rw == FS_DECRYPT) if (rw == FS_DECRYPT)
res = crypto_skcipher_decrypt(req); res = crypto_skcipher_decrypt(req);
else else
......
...@@ -109,6 +109,8 @@ int fscrypt_process_policy(struct file *filp, ...@@ -109,6 +109,8 @@ int fscrypt_process_policy(struct file *filp,
if (ret) if (ret)
return ret; return ret;
inode_lock(inode);
if (!inode_has_encryption_context(inode)) { if (!inode_has_encryption_context(inode)) {
if (!S_ISDIR(inode->i_mode)) if (!S_ISDIR(inode->i_mode))
ret = -EINVAL; ret = -EINVAL;
...@@ -127,6 +129,8 @@ int fscrypt_process_policy(struct file *filp, ...@@ -127,6 +129,8 @@ int fscrypt_process_policy(struct file *filp,
ret = -EINVAL; ret = -EINVAL;
} }
inode_unlock(inode);
mnt_drop_write_file(filp); mnt_drop_write_file(filp);
return ret; return ret;
} }
......
...@@ -128,12 +128,12 @@ static void debug_print_tree(struct ext4_sb_info *sbi) ...@@ -128,12 +128,12 @@ static void debug_print_tree(struct ext4_sb_info *sbi)
node = rb_first(&sbi->system_blks); node = rb_first(&sbi->system_blks);
while (node) { while (node) {
entry = rb_entry(node, struct ext4_system_zone, node); entry = rb_entry(node, struct ext4_system_zone, node);
printk("%s%llu-%llu", first ? "" : ", ", printk(KERN_CONT "%s%llu-%llu", first ? "" : ", ",
entry->start_blk, entry->start_blk + entry->count - 1); entry->start_blk, entry->start_blk + entry->count - 1);
first = 0; first = 0;
node = rb_next(node); node = rb_next(node);
} }
printk("\n"); printk(KERN_CONT "\n");
} }
int ext4_setup_system_zone(struct super_block *sb) int ext4_setup_system_zone(struct super_block *sb)
......
...@@ -27,16 +27,15 @@ ...@@ -27,16 +27,15 @@
#ifdef CONFIG_EXT4_DEBUG #ifdef CONFIG_EXT4_DEBUG
extern ushort ext4_mballoc_debug; extern ushort ext4_mballoc_debug;
#define mb_debug(n, fmt, a...) \ #define mb_debug(n, fmt, ...) \
do { \ do { \
if ((n) <= ext4_mballoc_debug) { \ if ((n) <= ext4_mballoc_debug) { \
printk(KERN_DEBUG "(%s, %d): %s: ", \ printk(KERN_DEBUG "(%s, %d): %s: " fmt, \
__FILE__, __LINE__, __func__); \ __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
printk(fmt, ## a); \
} \ } \
} while (0) } while (0)
#else #else
#define mb_debug(n, fmt, a...) no_printk(fmt, ## a) #define mb_debug(n, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif #endif
#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */ #define EXT4_MB_HISTORY_ALLOC 1 /* allocation */
......
...@@ -577,12 +577,13 @@ static inline unsigned dx_node_limit(struct inode *dir) ...@@ -577,12 +577,13 @@ static inline unsigned dx_node_limit(struct inode *dir)
static void dx_show_index(char * label, struct dx_entry *entries) static void dx_show_index(char * label, struct dx_entry *entries)
{ {
int i, n = dx_get_count (entries); int i, n = dx_get_count (entries);
printk(KERN_DEBUG "%s index ", label); printk(KERN_DEBUG "%s index", label);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
printk("%x->%lu ", i ? dx_get_hash(entries + i) : printk(KERN_CONT " %x->%lu",
0, (unsigned long)dx_get_block(entries + i)); i ? dx_get_hash(entries + i) : 0,
(unsigned long)dx_get_block(entries + i));
} }
printk("\n"); printk(KERN_CONT "\n");
} }
struct stats struct stats
...@@ -679,7 +680,7 @@ static struct stats dx_show_leaf(struct inode *dir, ...@@ -679,7 +680,7 @@ static struct stats dx_show_leaf(struct inode *dir,
} }
de = ext4_next_entry(de, size); de = ext4_next_entry(de, size);
} }
printk("(%i)\n", names); printk(KERN_CONT "(%i)\n", names);
return (struct stats) { names, space, 1 }; return (struct stats) { names, space, 1 };
} }
...@@ -798,7 +799,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir, ...@@ -798,7 +799,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
q = entries + count - 1; q = entries + count - 1;
while (p <= q) { while (p <= q) {
m = p + (q - p) / 2; m = p + (q - p) / 2;
dxtrace(printk(".")); dxtrace(printk(KERN_CONT "."));
if (dx_get_hash(m) > hash) if (dx_get_hash(m) > hash)
q = m - 1; q = m - 1;
else else
...@@ -810,7 +811,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir, ...@@ -810,7 +811,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
at = entries; at = entries;
while (n--) while (n--)
{ {
dxtrace(printk(",")); dxtrace(printk(KERN_CONT ","));
if (dx_get_hash(++at) > hash) if (dx_get_hash(++at) > hash)
{ {
at--; at--;
...@@ -821,7 +822,8 @@ dx_probe(struct ext4_filename *fname, struct inode *dir, ...@@ -821,7 +822,8 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
} }
at = p - 1; at = p - 1;
dxtrace(printk(" %x->%u\n", at == entries ? 0 : dx_get_hash(at), dxtrace(printk(KERN_CONT " %x->%u\n",
at == entries ? 0 : dx_get_hash(at),
dx_get_block(at))); dx_get_block(at)));
frame->entries = entries; frame->entries = entries;
frame->at = at; frame->at = at;
......
...@@ -597,14 +597,15 @@ void __ext4_std_error(struct super_block *sb, const char *function, ...@@ -597,14 +597,15 @@ void __ext4_std_error(struct super_block *sb, const char *function,
void __ext4_abort(struct super_block *sb, const char *function, void __ext4_abort(struct super_block *sb, const char *function,
unsigned int line, const char *fmt, ...) unsigned int line, const char *fmt, ...)
{ {
struct va_format vaf;
va_list args; va_list args;
save_error_info(sb, function, line); save_error_info(sb, function, line);
va_start(args, fmt); va_start(args, fmt);
printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: ", sb->s_id, vaf.fmt = fmt;
function, line); vaf.va = &args;
vprintk(fmt, args); printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: %pV\n",
printk("\n"); sb->s_id, function, line, &vaf);
va_end(args); va_end(args);
if ((sb->s_flags & MS_RDONLY) == 0) { if ((sb->s_flags & MS_RDONLY) == 0) {
...@@ -2715,12 +2716,12 @@ static void print_daily_error_info(unsigned long arg) ...@@ -2715,12 +2716,12 @@ static void print_daily_error_info(unsigned long arg)
es->s_first_error_func, es->s_first_error_func,
le32_to_cpu(es->s_first_error_line)); le32_to_cpu(es->s_first_error_line));
if (es->s_first_error_ino) if (es->s_first_error_ino)
printk(": inode %u", printk(KERN_CONT ": inode %u",
le32_to_cpu(es->s_first_error_ino)); le32_to_cpu(es->s_first_error_ino));
if (es->s_first_error_block) if (es->s_first_error_block)
printk(": block %llu", (unsigned long long) printk(KERN_CONT ": block %llu", (unsigned long long)
le64_to_cpu(es->s_first_error_block)); le64_to_cpu(es->s_first_error_block));
printk("\n"); printk(KERN_CONT "\n");
} }
if (es->s_last_error_time) { if (es->s_last_error_time) {
printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d", 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,12 +2730,12 @@ static void print_daily_error_info(unsigned long arg)
es->s_last_error_func, es->s_last_error_func,
le32_to_cpu(es->s_last_error_line)); le32_to_cpu(es->s_last_error_line));
if (es->s_last_error_ino) if (es->s_last_error_ino)
printk(": inode %u", printk(KERN_CONT ": inode %u",
le32_to_cpu(es->s_last_error_ino)); le32_to_cpu(es->s_last_error_ino));
if (es->s_last_error_block) if (es->s_last_error_block)
printk(": block %llu", (unsigned long long) printk(KERN_CONT ": block %llu", (unsigned long long)
le64_to_cpu(es->s_last_error_block)); le64_to_cpu(es->s_last_error_block));
printk("\n"); printk(KERN_CONT "\n");
} }
mod_timer(&sbi->s_err_report, jiffies + 24*60*60*HZ); /* Once a day */ mod_timer(&sbi->s_err_report, jiffies + 24*60*60*HZ); /* Once a day */
} }
......
...@@ -223,14 +223,18 @@ static struct attribute *ext4_attrs[] = { ...@@ -223,14 +223,18 @@ static struct attribute *ext4_attrs[] = {
EXT4_ATTR_FEATURE(lazy_itable_init); EXT4_ATTR_FEATURE(lazy_itable_init);
EXT4_ATTR_FEATURE(batched_discard); EXT4_ATTR_FEATURE(batched_discard);
EXT4_ATTR_FEATURE(meta_bg_resize); EXT4_ATTR_FEATURE(meta_bg_resize);
#ifdef CONFIG_EXT4_FS_ENCRYPTION
EXT4_ATTR_FEATURE(encryption); EXT4_ATTR_FEATURE(encryption);
#endif
EXT4_ATTR_FEATURE(metadata_csum_seed); EXT4_ATTR_FEATURE(metadata_csum_seed);
static struct attribute *ext4_feat_attrs[] = { static struct attribute *ext4_feat_attrs[] = {
ATTR_LIST(lazy_itable_init), ATTR_LIST(lazy_itable_init),
ATTR_LIST(batched_discard), ATTR_LIST(batched_discard),
ATTR_LIST(meta_bg_resize), ATTR_LIST(meta_bg_resize),
#ifdef CONFIG_EXT4_FS_ENCRYPTION
ATTR_LIST(encryption), ATTR_LIST(encryption),
#endif
ATTR_LIST(metadata_csum_seed), ATTR_LIST(metadata_csum_seed),
NULL, NULL,
}; };
......
...@@ -61,18 +61,12 @@ ...@@ -61,18 +61,12 @@
#include "acl.h" #include "acl.h"
#ifdef EXT4_XATTR_DEBUG #ifdef EXT4_XATTR_DEBUG
# define ea_idebug(inode, f...) do { \ # define ea_idebug(inode, fmt, ...) \
printk(KERN_DEBUG "inode %s:%lu: ", \ printk(KERN_DEBUG "inode %s:%lu: " fmt "\n", \
inode->i_sb->s_id, inode->i_ino); \ inode->i_sb->s_id, inode->i_ino, ##__VA_ARGS__)
printk(f); \ # define ea_bdebug(bh, fmt, ...) \
printk("\n"); \ printk(KERN_DEBUG "block %pg:%lu: " fmt "\n", \
} while (0) bh->b_bdev, (unsigned long)bh->b_blocknr, ##__VA_ARGS__)
# define ea_bdebug(bh, f...) do { \
printk(KERN_DEBUG "block %pg:%lu: ", \
bh->b_bdev, (unsigned long) bh->b_blocknr); \
printk(f); \
printk("\n"); \
} while (0)
#else #else
# define ea_idebug(inode, fmt, ...) no_printk(fmt, ##__VA_ARGS__) # define ea_idebug(inode, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
# define ea_bdebug(bh, fmt, ...) no_printk(fmt, ##__VA_ARGS__) # 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,7 +235,7 @@ __xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header,
int error = -EFSCORRUPTED; int error = -EFSCORRUPTED;
if (((void *) header >= end) || if (((void *) header >= end) ||
(header->h_magic != le32_to_cpu(EXT4_XATTR_MAGIC))) (header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)))
goto errout; goto errout;
error = ext4_xattr_check_names(entry, end, entry); error = ext4_xattr_check_names(entry, end, entry);
errout: errout:
......
...@@ -1149,6 +1149,7 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) ...@@ -1149,6 +1149,7 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
JBUFFER_TRACE(jh, "file as BJ_Reserved"); JBUFFER_TRACE(jh, "file as BJ_Reserved");
spin_lock(&journal->j_list_lock); spin_lock(&journal->j_list_lock);
__jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
spin_unlock(&journal->j_list_lock);
} else if (jh->b_transaction == journal->j_committing_transaction) { } else if (jh->b_transaction == journal->j_committing_transaction) {
/* first access by this transaction */ /* first access by this transaction */
jh->b_modified = 0; jh->b_modified = 0;
...@@ -1156,8 +1157,8 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) ...@@ -1156,8 +1157,8 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)
JBUFFER_TRACE(jh, "set next transaction"); JBUFFER_TRACE(jh, "set next transaction");
spin_lock(&journal->j_list_lock); spin_lock(&journal->j_list_lock);
jh->b_next_transaction = transaction; jh->b_next_transaction = transaction;
}
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
}
jbd_unlock_bh_state(bh); jbd_unlock_bh_state(bh);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment