vfs: fix possible deadlock in ext2, ext3, ext4 when using xattrs
[sfrench/cifs-2.6.git] / fs / ext2 / xattr.c
index af52a7f8b291d0baf3542246fb90703032cfbecc..a99d46f3b26eb032e13c5a3d9f26484518997b5c 100644 (file)
@@ -342,12 +342,9 @@ static void ext2_xattr_update_super_block(struct super_block *sb)
        if (EXT2_HAS_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR))
                return;
 
-       lock_super(sb);
-       EXT2_SB(sb)->s_es->s_feature_compat |=
-               cpu_to_le32(EXT2_FEATURE_COMPAT_EXT_ATTR);
+       EXT2_SET_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR);
        sb->s_dirt = 1;
        mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
-       unlock_super(sb);
 }
 
 /*
@@ -667,8 +664,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
                                                           s_first_data_block) +
                                   EXT2_I(inode)->i_block_group *
                                   EXT2_BLOCKS_PER_GROUP(sb);
-                       int block = ext2_new_block(inode, goal,
-                                                  NULL, NULL, &error);
+                       int block = ext2_new_block(inode, goal, &error);
                        if (error)
                                goto cleanup;
                        ea_idebug(inode, "creating block %d", block);
@@ -839,7 +835,7 @@ ext2_xattr_cache_insert(struct buffer_head *bh)
        struct mb_cache_entry *ce;
        int error;
 
-       ce = mb_cache_entry_alloc(ext2_xattr_cache);
+       ce = mb_cache_entry_alloc(ext2_xattr_cache, GFP_NOFS);
        if (!ce)
                return -ENOMEM;
        error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, &hash);