]> nv-tegra.nvidia Code Review - linux-3.10.git/commit
Btrfs: use a lock to protect incompat/compat flag of the super block
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 11 Apr 2013 10:30:16 +0000 (10:30 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Mon, 6 May 2013 19:54:46 +0000 (15:54 -0400)
commitceda08642459e31673d24d7968d864390d2ce5fa
tree57d1a9be32a9a2653011b5fedf6615731af48b7f
parentf42a34b2f10c411ef45f247f3000ed03ba4e80c0
Btrfs: use a lock to protect incompat/compat flag of the super block

The following case will make the incompat/compat flag of the super block
be recovered.
 Task1 |Task2
 flags = btrfs_super_incompat_flags(); |
|flags = btrfs_super_incompat_flags();
 flags |= new_flag1; |
|flags |= new_flag2;
 btrfs_set_super_incompat_flags(flags); |
|btrfs_set_super_incompat_flags(flags);
the new_flag1 is recovered.

In order to avoid this problem, we introduce a lock named super_lock into
the btrfs_fs_info structure. If we want to update incompat/compat flags
of the super block, we must hold it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/volumes.c