• M
    Btrfs: use a lock to protect incompat/compat flag of the super block · ceda0864
    Miao Xie 提交于
    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: NMiao Xie <miaox@cn.fujitsu.com>
    Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
    ceda0864
disk-io.c 106.7 KB