From: Andrew Morton <akpm@osdl.org>
To: Herbert Poetzl <herbert@13thfloor.at>
Cc: viro@ftp.linux.org.uk, linux-kernel@vger.kernel.org
Subject: Re: kjournald keeps reference to namespace
Date: Fri, 17 Feb 2006 17:54:28 -0800 [thread overview]
Message-ID: <20060217175428.7ce7b26f.akpm@osdl.org> (raw)
In-Reply-To: <20060218013547.GA32706@MAIL.13thfloor.at>
Herbert Poetzl <herbert@13thfloor.at> wrote:
>
>
> Hi Folks!
>
> when creating a private namespace (CLONE_NS) and
> then mounting an ext3 filesystem, a new kernel
> thread (kjournald) is created, which keeps a
> reference to the namespace, which after the the
> process exits, remains and blocks access to the
> block device, as it is still bd_claim-ed.
There are numerous ways in which user processes can parent kernel threads.
bix:/usr/src/linux-2.6.16-rc4> grep -rl kernel_thread drivers net fs | wc
64 64 1657
> this leaves a private namespace behind and a
> block device which cannot be opened exclusively.
> unmount is not an option, as the namespace is
> not longer reachable.
>
> this behaviour seems to be there since ever,
> well since namespaces and kjournald exists :)
>
> the following 'cruel' hack 'solves' this issue
>
> best,
> Herbert
>
>
> --- fs/jbd/journal.c.orig 2006-01-03 17:29:56 +0100
> +++ fs/jbd/journal.c 2006-02-18 02:23:21 +0100
> @@ -33,6 +33,7 @@
> #include <linux/mm.h>
> #include <linux/suspend.h>
> #include <linux/pagemap.h>
> +#include <linux/namespace.h>
> #include <asm/uaccess.h>
> #include <asm/page.h>
> #include <linux/proc_fs.h>
> @@ -116,6 +117,13 @@ static int kjournald(void *arg)
> struct timer_list timer;
>
> daemonize("kjournald");
> + {
> + struct namespace *ns = current->namespace;
> +
> + current->namespace = NULL;
> + put_namespace(ns);
> + }
> +
>
I think it'd be better to convert ext3 to use the kthread API which appears
to accidentally not have this problem, because such threads are parented by
keventd, which were parented by init.
That being said, perhaps we should do a put_namespace() in kernel_thread(),
too.
I'm kinda surprised that your patch didn't oops over a NULL ->namespace
when the kernel internally mounted the root filesystem.
next prev parent reply other threads:[~2006-02-18 1:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-18 1:35 kjournald keeps reference to namespace Herbert Poetzl
2006-02-18 1:54 ` Andrew Morton [this message]
2006-02-18 3:30 ` Herbert Poetzl
2006-02-24 21:28 ` Paul Collins
2006-02-24 21:36 ` Andrew Morton
2006-02-24 22:01 ` Paul Collins
2006-02-18 13:36 ` Björn Steinbrink
2006-02-18 16:32 ` Björn Steinbrink
2006-02-18 17:12 ` Björn Steinbrink
2006-02-19 2:32 ` 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=20060217175428.7ce7b26f.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ftp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.