public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: containers@lists.osdl.org, LKML <linux-kernel@vger.kernel.org>,
	Paul Menage <menage@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arjan van de Ven <arjan@infradead.org>,
	gregkh@ZenIV.linux.org.uk,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2()
Date: Mon, 16 Feb 2009 02:38:12 +0000	[thread overview]
Message-ID: <20090216023812.GT28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <4998C15C.2070203@cn.fujitsu.com>

On Mon, Feb 16, 2009 at 09:29:00AM +0800, Li Zefan wrote:
> >>                 struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu);
> >>                 spin_lock(&cpu_writer->lock);
> >>                 if (cpu_writer->mnt != mnt) {
> >> 			spin_unlock(&cpu_writer->lock);
> >>                         continue;
> >> 		}
> >> prevents the problem, OK?
> >>
> > 
> > Sure, I'll try. :)
> > 
> 
> Not a single warning for the whole weekend, so I think above change works.

OK...  So here's what we really want:
	* we know that nobody will set cpu_writer->mnt to mnt from now on
	* all changes to that sucker are done under cpu_writer->lock
	* we want the laziest equivalent of
		spin_lock(&cpu_writer->lock);
		if (likely(cpu_writer->mnt != mnt)) {
			spin_unlock(&cpu_writer->lock);
			continue;
		}
		/* do stuff */
that would make sure we won't miss earlier setting of ->mnt done by another
CPU.

Anyway, for now (HEAD and all -stable starting with 2.6.26) we want this:

--- fs/namespace.c	2009-01-25 21:45:31.000000000 -0500
+++ fs/namespace.c	2009-02-15 21:31:14.000000000 -0500
@@ -614,9 +614,11 @@
 	 */
 	for_each_possible_cpu(cpu) {
 		struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu);
-		if (cpu_writer->mnt != mnt)
-			continue;
 		spin_lock(&cpu_writer->lock);
+		if (cpu_writer->mnt != mnt) {
+			spin_unlock(&cpu_writer->lock);
+			continue;
+		}
 		atomic_add(cpu_writer->count, &mnt->__mnt_writers);
 		cpu_writer->count = 0;
 		/*

  reply	other threads:[~2009-02-16  2:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05  3:23 [cgroup or VFS ?] WARNING: at fs/namespace.c:636 mntput_no_expire+0xac/0xf2() Li Zefan
2009-02-09  8:40 ` Andrew Morton
2009-02-09  8:49   ` Li Zefan
2009-02-09 11:03     ` Al Viro
2009-02-09 11:58       ` Al Viro
2009-02-10  5:47         ` Li Zefan
2009-02-09  9:34   ` Al Viro
2009-02-09 11:30     ` Li Zefan
2009-02-12  6:10       ` Li Zefan
2009-02-12  6:24         ` Al Viro
2009-02-12  6:33           ` Li Zefan
2009-02-12  6:54             ` Li Zefan
2009-02-12  7:07               ` Al Viro
2009-02-13  5:09                 ` Li Zefan
2009-02-13  5:47                   ` Al Viro
2009-02-13  6:12                     ` Li Zefan
2009-02-13  6:31                       ` Li Zefan
2009-02-13  6:41                       ` Al Viro
2009-02-13  7:18                         ` Al Viro
2009-02-13  7:26                           ` Li Zefan
2009-02-16  1:29                             ` Li Zefan
2009-02-16  2:38                               ` Al Viro [this message]
2009-02-16  2:47                                 ` Li Zefan
2009-02-16  2:57                                   ` Al Viro
2009-02-09 17:48     ` Dave Hansen
2009-02-09 18:11       ` Arjan van de Ven

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=20090216023812.GT28946@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=containers@lists.osdl.org \
    --cc=gregkh@ZenIV.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    --cc=torvalds@linux-foundation.org \
    /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