Re: [PATCH 19/20] ext2: Add ext2_sb_info s_lock spinlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Blunck <jblunck@xxxxxxx> 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@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux