Messages in this thread |  | | | From | OGAWA Hirofumi <> | | Subject | Re: [PATCH 19/20] ext2: Add ext2_sb_info s_lock spinlock | | Date | Wed, 18 Nov 2009 21:31:16 +0900 |
| |
Jan Blunck <jblunck@suse.de> writes:
> +static void ext2_sync_super(struct super_block *sb, > + struct ext2_super_block *es) > { > + spin_lock(&EXT2_SB(sb)->s_lock); > es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); > es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); > es->s_wtime = cpu_to_le32(get_seconds()); > + /* unlock before we do IO */ > + spin_unlock(&EXT2_SB(sb)->s_lock); > mark_buffer_dirty(EXT2_SB(sb)->s_sbh); > sync_dirty_buffer(EXT2_SB(sb)->s_sbh); > sb->s_dirt = 0;
[...]
> static int ext2_sync_fs(struct super_block *sb, int wait) > { > - struct ext2_super_block *es = EXT2_SB(sb)->s_es; > + struct ext2_sb_info *sbi = EXT2_SB(sb); > + struct ext2_super_block *es = sbi->s_es; > > lock_kernel(); > + spin_lock(&sbi->s_lock); > if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) { > ext2_debug("setting valid to 0\n"); > es->s_state &= cpu_to_le16(~EXT2_VALID_FS); > @@ -1137,9 +1159,11 @@ static int ext2_sync_fs(struct super_block *sb, int wait) > es->s_free_inodes_count = > cpu_to_le32(ext2_count_free_inodes(sb)); > es->s_mtime = cpu_to_le32(get_seconds()); > + spin_unlock(&EXT2_SB(sb)->s_lock); > ext2_sync_super(sb, es); > } else { > ext2_commit_super(sb, es); > + spin_unlock(&sbi->s_lock); > } > sb->s_dirt = 0;
[...]
> @@ -1237,6 +1264,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) > if (!ext2_setup_super (sb, es, 0)) > sb->s_flags &= ~MS_RDONLY; > } > + spin_unlock(&EXT2_SB(sb)->s_lock); > ext2_sync_super(sb, es); > unlock_kernel(); > return 0;
ext2_setup_super() will call ext2_sync_fs(), so ->s_lock seems to be recursive in here.
Thanks. -- OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
|  |