ext2: Add ext2_sb_info s_lock spinlock
Add a spinlock that protects against concurrent modifications of s_mount_state, s_blocks_last, s_overhead_last and the content of the superblock's buffer pointed to by sbi->s_es. The spinlock is now used in ext2_xattr_update_super_block() which was setting the EXT2_FEATURE_COMPAT_EXT_ATTR flag on the superblock without protection before. Likewise the spinlock is used in ext2_show_options() to have a consistent view of the mount options. This is a preparation patch for removing the BKL from ext2 in the next patch. Signed-off-by: Jan Blunck <jblunck@suse.de> Cc: Andi Kleen <andi@firstfloor.org> Cc: Jan Kara <jack@suse.cz> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
@ -345,7 +345,9 @@ static void ext2_xattr_update_super_block(struct super_block *sb)
|
||||
if (EXT2_HAS_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR))
|
||||
return;
|
||||
|
||||
spin_lock(&EXT2_SB(sb)->s_lock);
|
||||
EXT2_SET_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR);
|
||||
spin_unlock(&EXT2_SB(sb)->s_lock);
|
||||
sb->s_dirt = 1;
|
||||
mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
|
||||
}
|
||||
|
Reference in New Issue
Block a user