From patchwork Thu Aug 11 21:29:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 109691 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E487EB6F81 for ; Fri, 12 Aug 2011 07:27:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754043Ab1HKV1p (ORCPT ); Thu, 11 Aug 2011 17:27:45 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:35726 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754034Ab1HKV1o (ORCPT ); Thu, 11 Aug 2011 17:27:44 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 7EDE11B7DCC; Thu, 11 Aug 2011 22:50:47 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 32513-09; Thu, 11 Aug 2011 22:50:36 +0200 (CEST) Received: from ferrari.rjw.lan (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id B6EF31B7AFF; Thu, 11 Aug 2011 22:50:36 +0200 (CEST) From: "Rafael J. Wysocki" To: linux-ext4@vger.kernel.org Subject: [PATCH] Date: Thu, 11 Aug 2011 23:29:22 +0200 User-Agent: KMail/1.13.6 (Linux/3.1.0-rc1+; KDE/4.6.0; x86_64; ; ) Cc: linux-fsdevel@vger.kernel.org, LKML , Dave Chinner MIME-Version: 1.0 Message-Id: <201108112329.23043.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Rafael J. Wysocki Subject: fs / ext3: Always unlock updates in ext3_freeze() In analogy with ext4 make ext3_freeze() always call journal_unlock_updates() to prevent it from leaving a locked mutex behind. Accordingly, modify ext3_unfreeze() so that it doesn't call journal_unlock_updates() any more. Signed-off-by: Rafael J. Wysocki --- fs/ext3/super.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/fs/ext3/super.c =================================================================== --- linux.orig/fs/ext3/super.c +++ linux/fs/ext3/super.c @@ -2535,30 +2535,28 @@ static int ext3_sync_fs(struct super_blo */ static int ext3_freeze(struct super_block *sb) { - int error = 0; + int error; journal_t *journal; - if (!(sb->s_flags & MS_RDONLY)) { - journal = EXT3_SB(sb)->s_journal; + if (sb->s_flags & MS_RDONLY) + return 0; - /* Now we set up the journal barrier. */ - journal_lock_updates(journal); + journal = EXT3_SB(sb)->s_journal; - /* - * We don't want to clear needs_recovery flag when we failed - * to flush the journal. - */ - error = journal_flush(journal); - if (error < 0) - goto out; - - /* Journal blocked and flushed, clear needs_recovery flag. */ - EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); - error = ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1); - if (error) - goto out; - } - return 0; + /* Now we set up the journal barrier. */ + journal_lock_updates(journal); + + /* + * We don't want to clear needs_recovery flag when we failed + * to flush the journal. + */ + error = journal_flush(journal); + if (error < 0) + goto out; + + /* Journal blocked and flushed, clear needs_recovery flag. */ + EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); + error = ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1); out: journal_unlock_updates(journal); @@ -2577,7 +2575,6 @@ static int ext3_unfreeze(struct super_bl EXT3_SET_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1); unlock_super(sb); - journal_unlock_updates(EXT3_SB(sb)->s_journal); } return 0; }