public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Andrew Morton <akpm@osdl.org>
Cc: Pavel Machek <pavel@ucw.cz>, LKML <linux-kernel@vger.kernel.org>,
	Nigel Cunningham <ncunningham@linuxmail.org>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH -mm] swsusp: Freeze filesystems during suspend (rev. 2)
Date: Wed, 1 Nov 2006 21:22:41 +0100	[thread overview]
Message-ID: <200611012122.42362.rjw@sisk.pl> (raw)
In-Reply-To: <20061101115458.bb02f1d3.akpm@osdl.org>

On Wednesday, 1 November 2006 20:54, Andrew Morton wrote:
> On Wed, 1 Nov 2006 18:53:07 +0100
> "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> 
> > +void freeze_filesystems(void)
> > +{
> > +	struct super_block *sb;
> > +
> > +	lockdep_off();
> > +	/*
> > +	 * Freeze in reverse order so filesystems dependant upon others are
> > +	 * frozen in the right order (eg. loopback on ext3).
> > +	 */
> > +	list_for_each_entry_reverse(sb, &super_blocks, s_list) {
> > +		if (!sb->s_root || !sb->s_bdev ||
> > +		    (sb->s_frozen == SB_FREEZE_TRANS) ||
> > +		    (sb->s_flags & MS_RDONLY) ||
> > +		    (sb->s_flags & MS_FROZEN))
> > +			continue;
> > +
> > +		freeze_bdev(sb->s_bdev);
> > +		sb->s_flags |= MS_FROZEN;
> > +	}
> > +	lockdep_on();
> > +}
> > +
> > +/**
> > + * thaw_filesystems - unlock all filesystems
> > + */
> > +void thaw_filesystems(void)
> > +{
> > +	struct super_block *sb;
> > +
> > +	lockdep_off();
> > +
> > +	list_for_each_entry(sb, &super_blocks, s_list)
> > +		if (sb->s_flags & MS_FROZEN) {
> > +			sb->s_flags &= ~MS_FROZEN;
> > +			thaw_bdev(sb->s_bdev, sb);
> > +		}
> > +
> > +	lockdep_on();
> > +}
> 
> argh.
> 
> The uncommented, unchangelogged lockdep_off() calls are completely
> mysterious right now, even before the patch is merged.  They will not
> become less mysterious over time.

Of course.  Sorry.

> Please, take pity upon the readers of your code.  Add a comment.

OK (on top of the previous patch)

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 fs/buffer.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: linux-2.6.19-rc4-mm1/fs/buffer.c
===================================================================
--- linux-2.6.19-rc4-mm1.orig/fs/buffer.c
+++ linux-2.6.19-rc4-mm1/fs/buffer.c
@@ -252,6 +252,11 @@ void freeze_filesystems(void)
 {
 	struct super_block *sb;
 
+	/*
+	 * We are going to take several locks of the same class in a row
+	 * without releasing them until thaw_filesystems() is called and
+	 * lockdep won't know this is all OK.
+	 */
 	lockdep_off();
 	/*
 	 * Freeze in reverse order so filesystems dependant upon others are
@@ -277,6 +282,10 @@ void thaw_filesystems(void)
 {
 	struct super_block *sb;
 
+	/*
+	 * We are going to release several locks of the same class in a row
+	 * and lockdep would complain about it, unnecessarily.
+	 */
 	lockdep_off();
 
 	list_for_each_entry(sb, &super_blocks, s_list)


      reply	other threads:[~2006-11-01 20:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-01 11:00 [PATCH -mm] swsusp: Freeze filesystems during suspend Rafael J. Wysocki
2006-11-01 11:47 ` Pavel Machek
2006-11-01 12:05   ` Rafael J. Wysocki
2006-11-01 17:53   ` [PATCH -mm] swsusp: Freeze filesystems during suspend (rev. 2) Rafael J. Wysocki
2006-11-01 19:45     ` Andrew Morton
2006-11-01 20:27       ` Rafael J. Wysocki
2006-11-01 21:21         ` Andrew Morton
2006-11-02 20:53           ` Rafael J. Wysocki
2006-11-01 19:54     ` Andrew Morton
2006-11-01 20:22       ` Rafael J. Wysocki [this message]

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=200611012122.42362.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncunningham@linuxmail.org \
    --cc=pavel@ucw.cz \
    /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