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 Message-ID: <87pr7g3tgr.fsf@devron.myhome.or.jp> References: <1258536293-7762-1-git-send-email-jblunck@suse.de> <1258536293-7762-20-git-send-email-jblunck@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, Linux-Kernel Mailinglist , Andrew Morton , jkacur@redhat.com, Thomas Gleixner , Christoph Hellwig , Arnd Bergmann , matthew@wil.cx, Andi Kleen , Jan Kara To: Jan Blunck Return-path: Received: from mail.parknet.jp ([210.171.162.6]:45189 "EHLO mail.officemail.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751498AbZKRMbS (ORCPT ); Wed, 18 Nov 2009 07:31:18 -0500 In-Reply-To: <1258536293-7762-20-git-send-email-jblunck@suse.de> (Jan Blunck's message of "Wed, 18 Nov 2009 10:24:52 +0100") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Jan Blunck 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