public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	t-sato@yk.jp.nec.com
Subject: Re: [PATCH V4] Allow SysRq emergency thaw to thaw frozen filesystems
Date: Tue, 3 Feb 2009 14:01:35 -0800	[thread overview]
Message-ID: <20090203140135.fe8360f6.akpm@linux-foundation.org> (raw)
In-Reply-To: <498779D6.7010304@redhat.com>

On Mon, 02 Feb 2009 16:55:18 -0600
Eric Sandeen <sandeen@redhat.com> wrote:

> (this version fixes a couple small issues raised by Randy Dunlap)
> (and adds sb_lock locking I forgot, as akpm pointed out)
> (Randy's CONFIG_BLOCK fix should still apply over this)

<converts it to a delta so I can see what you did>

--- a/fs/buffer.c~allow-sysrq-emergency-thaw-to-thaw-frozen-filesystems-v4
+++ a/fs/buffer.c
@@ -263,11 +263,13 @@ void do_thaw_all(unsigned long unused)
 	struct super_block *sb;
 	char b[BDEVNAME_SIZE];
 
+	spin_lock(&sb_lock);
 	list_for_each_entry(sb, &super_blocks, s_list) {
 		while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
 			printk(KERN_WARNING "Emergency Thaw on %s\n",
 			       bdevname(sb->s_bdev, b));
 	}
+	spin_unlock(&sb_lock);
 	printk(KERN_WARNING "Emergency Thaw complete\n");
 }
 
_


Can't call thaw_bdev() under spinlock.


If we're going to do this, I think it will need the whole
sb_lock/s_count/s_umount song-n-dance.

It's a pretty common operation.  What you want is, I think, identical
to sync_supers(), only with one line changed.

so we could do

void apply_to_all_supers(void (fn)(struct super_block *))
{
	struct super_block *sb;

	spin_lock(&sb_lock);
restart:
	list_for_each_entry(sb, &super_blocks, s_list) {
		if (sb->s_dirt) {
			sb->s_count++;
			spin_unlock(&sb_lock);
			down_read(&sb->s_umount);
			(*fn)(sb);
			up_read(&sb->s_umount);
			spin_lock(&sb_lock);
			if (__put_super_and_need_restart(sb))
				goto restart;
		}
	}
	spin_unlock(&sb_lock);

}

That isn't quite sufficient to use for get_super(), but I think it
could be made so.

Ditto user_get_super().

Ditto do_emergency_remount()

But that's a separate little project for someone.  For the purposes of
this patch I guess you could do yet another copy-n-paste.


  parent reply	other threads:[~2009-02-03 22:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15  4:06 [PATCH] Allow SysRq emergency sync to thaw frozen filesystems Eric Sandeen
2009-01-16  0:20 ` Andrew Morton
2009-01-16  3:49   ` Eric Sandeen
2009-01-16  3:59     ` Eric Sandeen
2009-01-16 15:33       ` Valdis.Kletnieks
2009-01-16 15:40         ` Eric Sandeen
2009-01-16 16:21     ` Dave Kleikamp
2009-01-16 16:42       ` Dave Kleikamp
2009-01-16  8:48 ` Pavel Machek
2009-01-16 15:17   ` Valdis.Kletnieks
2009-01-16 15:28     ` Eric Sandeen
2009-01-16 15:33     ` Pavel Machek
2009-01-16 15:40     ` Theodore Tso
2009-01-16 15:52       ` Valdis.Kletnieks
2009-01-16 16:08       ` Eric Sandeen
2009-01-16 19:31 ` [PATCH V2] Allow SysRq emergency thaw " Eric Sandeen
2009-01-16 19:38   ` Randy Dunlap
2009-01-16 19:46     ` Eric Sandeen
2009-01-16 19:50   ` [PATCH V3] " Eric Sandeen
2009-01-30 21:40     ` Andrew Morton
2009-02-02 22:55       ` [PATCH V4] " Eric Sandeen
2009-02-03 11:48         ` Jamie Lokier
2009-02-03 13:31           ` Dave Kleikamp
2009-02-03 21:21           ` Dave Chinner
2009-02-03 22:01         ` Andrew Morton [this message]
2009-02-03 22:07           ` Eric Sandeen
2009-02-03 22:21             ` Andrew Morton
2009-02-16 22:01           ` [PATCH V5] " Eric Sandeen

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=20090203140135.fe8360f6.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=t-sato@yk.jp.nec.com \
    /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