Linux Container Development
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
Cc: kyle-hoO6YkzgTuCM0SS3m2neIg@public.gmane.org,
	bastian-yyjItF7Rl6lg9hUCZPvPmw@public.gmane.org,
	Dave Hansen
	<dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
	ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org,
	sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
	alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org,
	xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH 08/10] Define get_sb_ref()
Date: Tue, 30 Sep 2008 10:13:25 -0500	[thread overview]
Message-ID: <20080930151325.GA26713@us.ibm.com> (raw)
In-Reply-To: <48E0DF71.2070007-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>

Quoting Cedric Le Goater (clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org):
> sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org wrote:
> > Dave Hansen [dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org] wrote:
> > | On Fri, 2008-09-26 at 14:21 -0700, sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org wrote:
> > | > Dave Hansen [dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org] wrote:
> > | > | On Fri, 2008-09-12 at 10:53 -0700, sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org wrote:
> > | > | > + *     But for single-mount semantics, devpts cannot use get_sb_single(),
> > | > | > + *     because get_sb_single()/sget() find and use the super-block from
> > | > | > + *     the most recent mount of devpts. But that recent mount may be a
> > | > | > + *     'newinstance' mount and get_sb_single() would pick the newinstance
> > | > | > + *     super-block instead of the initial super-block.
> > | > | 
> > | > | Can't you just override the test() function to get what you want here?
> > | > 
> > | > get_sb_single() does not take a test() parameter and so I would still
> > | > need a get_sb_ref() or get_sb_special() interface right ? 
> > | > 
> > | > This special interface could call sget() with a custom-test function,
> > | > to get the super-block.  But in case of devpts, we already have the
> > | > super-block. So we don't need to call sget(). We just need get a reference
> > | > and remount.
> > | 
> > | Well, you shouldn't be using get_sb_single() at all any more, right?
> > 
> > You mean define something like get_sb_multi_mode() and define a  new
> > test function ? I can try that.
> > 
> > | 
> > | At this point, you're doing something super-specialized for devpts.  So,
> > | why do this in super.c.  Just put it in place of devpts_get_sb()'s
> > | current contents.
> > 
> > grab_super() is static. I have to either externalize it or define the
> > new interface in fs/super.c.  I am not sure if mqueue ns or others have
> > similar semantics and if so, defining interface in fs/super.c has a better
> > chance of being found/generalized when there is another user.
> 
> mqueue ns and proc have similar needs but there are those special little
> things that make difficult to share a common routine.
> 
> Here's the get_sb_single_ns() we would like to share. 
> 
> C.
>   
> From: Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
> 
> This patch defines the mqueuefs ->get_sb routine as follows:
>   . when allocating a new super_block, the mq namespace is stored in that
>     super_block s_fs_info attribute.
>   . when looking for a super_block, a comparison is done against the
>     s_fs_info attribute (it should be equal to the mq namespace that will
>     be passed in as a data parameter).
> 
> Signed-off-by: Nadia Derbey <Nadia.Derbey-6ktuUTfB/bM@public.gmane.org>
> Signed-off-by: Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
> 
> ---
>  ipc/mqueue.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 51 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6.27-rc7/ipc/mqueue.c
> ===================================================================
> --- linux-2.6.27-rc7.orig/ipc/mqueue.c	2008-09-25 15:03:58.000000000 +0200
> +++ linux-2.6.27-rc7/ipc/mqueue.c	2008-09-25 16:28:13.000000000 +0200
> @@ -201,6 +201,48 @@ static int mqueue_fill_super(struct supe
>  	return 0;
>  }
> 
> +static int compare_sb_single_ns(struct super_block *sb, void *data)
> +{
> +	return sb->s_fs_info == data;
> +}
> +
> +static int set_sb_single_ns(struct super_block *sb, void *data)
> +{
> +	struct mq_namespace *mq_ns = (struct mq_namespace *) data;
> +	int error;
> +
> +	sb->s_fs_info = get_mq_ns(mq_ns);
> +	error = set_anon_super(sb, NULL);
> +	if (error)
> +		put_mq_ns(mq_ns);

Hmm, how come fs/proc/root.c doesn't do a put_pid_ns if set_anon_super()
failed?  Does it need to do that, or is there some part of the error
path cleanup at a higher level that would cause that to happen anyway
(i.e. kill_sb ends up being called anyway)?

> +	return error;
> +}
> +
> +static int get_sb_single_ns(struct file_system_type *fs_type,
> +	int flags, void *data,
> +	int (*fill_super)(struct super_block *, void *, int),
> +	struct vfsmount *mnt)
> +{
> +	struct super_block *s;
> +	int error;
> +
> +	s = sget(fs_type, compare_sb_single_ns, set_sb_single_ns, data);
> +	if (IS_ERR(s))
> +		return PTR_ERR(s);
> +	if (!s->s_root) {
> +		s->s_flags = flags;
> +		error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
> +		if (error) {
> +			up_write(&s->s_umount);
> +			deactivate_super(s);
> +			return error;
> +		}
> +		s->s_flags |= MS_ACTIVE;
> +	}
> +	do_remount_sb(s, flags, data, 0);
> +	return simple_set_mnt(mnt, s);
> +}
> +
>  static int mqueue_get_sb(struct file_system_type *fs_type,
>  			 int flags, const char *dev_name,
>  			 void *data, struct vfsmount *mnt)
> @@ -208,6 +250,14 @@ static int mqueue_get_sb(struct file_sys
>  	return get_sb_single(fs_type, flags, data, mqueue_fill_super, mnt);
>  }
> 
> +static void mqueue_kill_sb(struct super_block *sb)
> +{
> +	struct mq_namespace *mq_ns = (struct mq_namespace *) sb->s_fs_info;
> +
> +	kill_litter_super(sb);
> +	put_mq_ns(mq_ns);
> +}
> +
>  static void init_once(void *foo)
>  {
>  	struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo;
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

  parent reply	other threads:[~2008-09-30 15:13 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12 17:48 [PATCH 0/10][v4]: Enable multiple devpts instances sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found] ` <20080912174845.GA17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-12 17:50   ` [PATCH 01/10] Remove devpts_root global sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175057.GB17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 17:04       ` Serge E. Hallyn
2008-09-12 17:51   ` [PATCH 02/10] Per-mount allocated_ptys sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175116.GC17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 17:14       ` Serge E. Hallyn
     [not found]         ` <20080924171408.GB25255-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-27  1:12           ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
2008-09-12 17:51   ` [PATCH 03/10] Per-mount 'config' object sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175135.GD17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 17:20       ` Serge E. Hallyn
2008-09-12 17:51   ` [PATCH 04/10] Extract option parsing to new function sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175153.GE17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 17:23       ` Serge E. Hallyn
2008-09-12 17:52   ` [PATCH 05/10] Add DEVPTS_MULTIPLE_INSTANCES config token sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175210.GF17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 17:24       ` Serge E. Hallyn
2008-09-12 17:52   ` [PATCH 06/10] Define mknod_ptmx() sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175237.GG17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 18:21       ` Serge E. Hallyn
     [not found]         ` <20080924182125.GF25255-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-26 21:32           ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
2008-09-24 18:50       ` Serge E. Hallyn
     [not found]         ` <20080924185046.GA31535-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-26 21:29           ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
     [not found]             ` <20080926212954.GE31505-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-29 13:14               ` Serge E. Hallyn
2008-09-12 17:52   ` [PATCH 07/10] Update ptmx permissions during remount sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175252.GH17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 18:30       ` Serge E. Hallyn
2008-09-12 17:53   ` [PATCH 08/10] Define get_sb_ref() sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175308.GI17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 19:20       ` Serge E. Hallyn
2008-09-24 19:55       ` Dave Hansen
2008-09-26 21:21         ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
     [not found]           ` <20080926212115.GD31505-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-26 21:31             ` Dave Hansen
2008-09-27  0:47               ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
     [not found]                 ` <20080927004727.GA2161-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-29 14:00                   ` Cedric Le Goater
     [not found]                     ` <48E0DF71.2070007-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2008-09-30 15:13                       ` Serge E. Hallyn [this message]
     [not found]                         ` <20080930151325.GA26713-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-01 12:38                           ` Cedric Le Goater
2008-09-27 20:29               ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
     [not found]                 ` <20080927202924.GA16208-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-04  3:09                   ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
2008-09-12 17:53   ` [PATCH 09/10] Enable multiple instances of devpts sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175322.GJ17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-24 20:26       ` Serge E. Hallyn
     [not found]         ` <20080924202616.GB31664-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-26 21:03           ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
     [not found]             ` <20080926210347.GB31505-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-29 13:01               ` Serge E. Hallyn
     [not found]                 ` <20080929130131.GA12531-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-29 15:18                   ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
     [not found]                     ` <20080929151828.GA10202-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-29 15:29                       ` Serge E. Hallyn
     [not found]                         ` <20080929152951.GA32518-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-29 15:58                           ` Cedric Le Goater
2008-09-29 14:06               ` Cedric Le Goater
2008-09-12 17:53   ` [PATCH 10/10] Document usage of multiple-instances " sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <20080912175347.GK17350-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-19 15:33       ` Alan Cox
     [not found]         ` <20080919163311.626b715f-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2008-09-19 16:53           ` H. Peter Anvin
2008-09-20 16:17           ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
     [not found]             ` <20080920161717.GA23693-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-22 13:29               ` Serge E. Hallyn
     [not found]                 ` <20080922132937.GA11932-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-22 19:25                   ` Serge E. Hallyn
2008-09-22 16:16               ` Serge E. Hallyn
     [not found]                 ` <20080922161658.GA27087-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-22 16:33                   ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
2008-09-24 20:36       ` Serge E. Hallyn
     [not found]         ` <20080924203650.GC31664-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-09-26 21:05           ` sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8

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=20080930151325.GA26713@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org \
    --cc=bastian-yyjItF7Rl6lg9hUCZPvPmw@public.gmane.org \
    --cc=clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=kyle-hoO6YkzgTuCM0SS3m2neIg@public.gmane.org \
    --cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.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