LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Cedric Le Goater <clg@fr.ibm.com>
Cc: Daniel Hokka Zakrisson <daniel@hozac.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	linux-kernel@vger.kernel.org, herbert@13thfloor.at,
	akpm@osdl.org, trond.myklebust@fys.uio.no,
	Linux Containers <containers@lists.osdl.org>
Subject: Re: NFS causing oops when freeing namespace
Date: Wed, 17 Jan 2007 22:46:32 +0300	[thread overview]
Message-ID: <20070117194632.GA1071@tv-sign.ru> (raw)
In-Reply-To: <45AE7705.4040603@fr.ibm.com>

On 01/17, Cedric Le Goater wrote:
>
> Oleg Nesterov wrote:
> > On 01/17, Daniel Hokka Zakrisson wrote:
> >> It was the only semi-plausible explanation I could come up with. I added a
> >> printk in do_exit right before exit_task_namespaces, where sighand was
> >> still set, and one right before the spin_lock_irq in lockd_down, where it
> >> had suddenly been set to NULL.
> > 
> > I can't reproduce the problem, but
> 
> I did on a 2.6.20-rc4-mm1.
> 
> > 	do_exit:
> > 		exit_notify(tsk);
> > 		exit_task_namespaces(tsk);
> > 
> > the task could be reaped by its parent in between.
> 
> indeed. while it goes spleeping in lockd_down() just before it does
> 
> 	spin_lock_irq(&current->sighand->siglock);
> 
> current->sighand is valid before interruptible_sleep_on_timeout() and
> not after.
>  
> > We should not use ->signal/->sighand after exit_notify().
> > 
> > Can we move exit_task_namespaces() up?
> 
> yes but I moved it down because it invalidates ->nsproxy ... 

Well, we can fix the symptom if we change lockd_down() to use
lock_task_sighand(), or something like this,

	--- NFS/fs/lockd/svc.c~lockd_down	2006-11-27 21:20:11.000000000 +0300
	+++ NFS/fs/lockd/svc.c	2007-01-17 22:39:47.000000000 +0300
	@@ -314,6 +314,7 @@ void
	 lockd_down(void)
	 {
		static int warned;
	+	int sigpending;
	 
		mutex_lock(&nlmsvc_mutex);
		if (nlmsvc_users) {
	@@ -334,16 +335,15 @@ lockd_down(void)
		 * Wait for the lockd process to exit, but since we're holding
		 * the lockd semaphore, we can't wait around forever ...
		 */
	-	clear_thread_flag(TIF_SIGPENDING);
	+	sigpending = test_and_clear_thread_flag(TIF_SIGPENDING);
		interruptible_sleep_on_timeout(&lockd_exit, HZ);
		if (nlmsvc_pid) {
			printk(KERN_WARNING 
				"lockd_down: lockd failed to exit, clearing pid\n");
			nlmsvc_pid = 0;
		}
	-	spin_lock_irq(&current->sighand->siglock);
	-	recalc_sigpending();
	-	spin_unlock_irq(&current->sighand->siglock);
	+	if (sigpending)	/* can be wrong at this point, harmless */
	+		set_thread_flag(TIF_SIGPENDING);
	 out:
		mutex_unlock(&nlmsvc_mutex);
	 }

but this is not good anyway.

Oleg.


  reply	other threads:[~2007-01-17 19:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-17 10:28 Daniel Hokka Zakrisson
2007-01-17 12:44 ` Eric W. Biederman
2007-01-17 13:13   ` Daniel Hokka Zakrisson
2007-01-17 18:58     ` Oleg Nesterov
2007-01-17 19:20       ` Cedric Le Goater
2007-01-17 19:46         ` Oleg Nesterov [this message]
2007-01-17 20:31           ` Cedric Le Goater
2007-01-17 22:30             ` Eric W. Biederman
2007-01-17 22:46               ` Trond Myklebust
2007-01-17 22:55               ` Oleg Nesterov
2007-01-18  4:46                 ` Eric W. Biederman

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=20070117194632.GA1071@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=clg@fr.ibm.com \
    --cc=containers@lists.osdl.org \
    --cc=daniel@hozac.com \
    --cc=ebiederm@xmission.com \
    --cc=herbert@13thfloor.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    --subject='Re: NFS causing oops when freeing namespace' \
    /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

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).