diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2010-05-16 22:00:00 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-05-16 22:00:00 -0400 |
commit | 12e9b892002d9af057655d35b44db8ee9243b0dc (patch) | |
tree | c5831b4bcf98eebdd39158d08dab97c198f5c683 /fs/ext4/ialloc.c | |
parent | 24676da469f50f433baa347845639662c561d1f6 (diff) |
ext4: Use bitops to read/modify i_flags in struct ext4_inode_info
At several places we modify EXT4_I(inode)->i_flags without holding
i_mutex (ext4_do_update_inode, ...). These modifications are racy and
we can lose updates to i_flags. So convert handling of i_flags to use
bitops which are atomic.
https://bugzilla.kernel.org/show_bug.cgi?id=15792
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r-- | fs/ext4/ialloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 52618d5a1773..7f6b5826d5a6 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -492,7 +492,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent, | |||
492 | 492 | ||
493 | if (S_ISDIR(mode) && | 493 | if (S_ISDIR(mode) && |
494 | ((parent == sb->s_root->d_inode) || | 494 | ((parent == sb->s_root->d_inode) || |
495 | (EXT4_I(parent)->i_flags & EXT4_TOPDIR_FL))) { | 495 | (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) { |
496 | int best_ndir = inodes_per_group; | 496 | int best_ndir = inodes_per_group; |
497 | int ret = -1; | 497 | int ret = -1; |
498 | 498 | ||
@@ -1038,7 +1038,7 @@ got: | |||
1038 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) { | 1038 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) { |
1039 | /* set extent flag only for directory, file and normal symlink*/ | 1039 | /* set extent flag only for directory, file and normal symlink*/ |
1040 | if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { | 1040 | if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { |
1041 | EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; | 1041 | ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS); |
1042 | ext4_ext_tree_init(handle, inode); | 1042 | ext4_ext_tree_init(handle, inode); |
1043 | } | 1043 | } |
1044 | } | 1044 | } |