linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, viro@ZenIV.linux.org.uk,
	josef@redhat.com, jeffmerkey@gmail.com
Subject: [PATCH 1/5] fsfreeze: Prevent emergency thaw from looping infinitely
Date: Thu, 10 Jun 2010 17:19:50 +1000	[thread overview]
Message-ID: <1276154395-24766-2-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1276154395-24766-1-git-send-email-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

The thawing of a filesystem through sysrq-j loops infinitely as it
incorrectly detects a thawed filesytsem as frozen and tries to
unfreeze repeatedly. This is a regression caused by
4504230a71566785a05d3e6b53fa1ee071b864eb ("freeze_bdev: grab active
reference to frozen superblocks") in that it no longer returned
-EINVAL for superblocks that were not frozen.

Return -EINVAL when the filesystem is already unfrozen to avoid this
problem.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/block_dev.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 7346c96..366ac38 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -276,22 +276,19 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb)
 	if (!bdev->bd_fsfreeze_count)
 		goto out;
 
-	error = 0;
-	if (--bdev->bd_fsfreeze_count > 0)
+	if (!sb)
 		goto out;
 
-	if (!sb)
+	error = 0;
+	if (--bdev->bd_fsfreeze_count > 0)
 		goto out;
 
 	error = thaw_super(sb);
-	if (error) {
+	if (error)
 		bdev->bd_fsfreeze_count++;
-		mutex_unlock(&bdev->bd_fsfreeze_mutex);
-		return error;
-	}
 out:
 	mutex_unlock(&bdev->bd_fsfreeze_mutex);
-	return 0;
+	return error;
 }
 EXPORT_SYMBOL(thaw_bdev);
 
-- 
1.7.1

  reply	other threads:[~2010-06-10  7:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10  7:19 [RFC, PATCH 0/5] fsfreeze: fix sb vs bdev freeze/thaw b0rkage Dave Chinner
2010-06-10  7:19 ` Dave Chinner [this message]
2010-06-14 15:18   ` [PATCH 1/5] fsfreeze: Prevent emergency thaw from looping infinitely Christoph Hellwig
2010-06-14 23:19     ` Dave Chinner
2010-06-10  7:19 ` [PATCH 2/5] fsfreeze: emergency thaw will deadlock on s_umount Dave Chinner
2010-06-14 15:20   ` Christoph Hellwig
2010-06-14 23:21     ` Dave Chinner
2010-06-21  1:57     ` Dave Chinner
2010-06-21  7:47       ` Christoph Hellwig
2010-06-10  7:19 ` [PATCH 3/5] fsfreeze: freeze_super and thaw_bdev don't play well together Dave Chinner
2010-06-14 15:22   ` Christoph Hellwig
2010-06-15  0:01     ` Dave Chinner
2010-06-15  6:24       ` Christoph Hellwig
2010-06-10  7:19 ` [PATCH 4/5] fsfreeze: switch to using super methods everywhere Dave Chinner
2010-06-14 15:23   ` Christoph Hellwig
2010-06-10  7:19 ` [PATCH 5/5] fsfreeze: move emergency thaw code to fs/super.c Dave Chinner
2010-06-14 15:25   ` Christoph Hellwig
2010-06-10 12:45 ` [RFC, PATCH 0/5] fsfreeze: fix sb vs bdev freeze/thaw b0rkage Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276154395-24766-2-git-send-email-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=jeffmerkey@gmail.com \
    --cc=josef@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).