From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 5/6] hfsplus: use alloc_mutex in hfsplus_sync_fs Date: Sun, 26 Sep 2010 23:20:34 +0200 Message-ID: <20100926212034.GE6394@lst.de> References: <20100926211920.GA6394@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: viro@zeniv.linux.org.uk, zippel@linux-m68k.org Return-path: Received: from verein.lst.de ([213.95.11.210]:46962 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757605Ab0IZVUk (ORCPT ); Sun, 26 Sep 2010 17:20:40 -0400 Content-Disposition: inline In-Reply-To: <20100926211920.GA6394@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Use alloc_mutex to protect hfsplus_sync_fs against itself and concurrent allocations, which allows to get rid of lock_super in hfsplus. Note that most fields in the superblock still aren't protected against concurrent allocations, that will follow later. Signed-off-by: Christoph Hellwig Index: linux-2.6/fs/hfsplus/super.c =================================================================== --- linux-2.6.orig/fs/hfsplus/super.c 2010-09-27 05:25:07.450327791 +0900 +++ linux-2.6/fs/hfsplus/super.c 2010-09-27 05:26:11.439327789 +0900 @@ -162,7 +162,7 @@ int hfsplus_sync_fs(struct super_block * dprint(DBG_SUPER, "hfsplus_write_super\n"); - lock_super(sb); + mutex_lock(&HFSPLUS_SB(sb).alloc_mutex); sb->s_dirt = 0; vhdr->free_blocks = cpu_to_be32(HFSPLUS_SB(sb).free_blocks); @@ -195,7 +195,7 @@ int hfsplus_sync_fs(struct super_block * } HFSPLUS_SB(sb).flags &= ~HFSPLUS_SB_WRITEBACKUP; } - unlock_super(sb); + mutex_unlock(&HFSPLUS_SB(sb).alloc_mutex); return 0; }