linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Jan Blunck <j.blunck@tu-harburg.de>
Subject: Re: [RFC][PATCH  7/14] Union-mount mounting
Date: Wed, 16 May 2007 10:34:08 +0530	[thread overview]
Message-ID: <20070516050408.GA4403@in.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0705150921300.9570@yvahk01.tjqt.qr>

On Tue, May 15, 2007 at 09:29:39AM +0200, Jan Engelhardt wrote:
> 
> On May 14 2007 15:11, Bharata B Rao wrote:
> >
> >TODO: bind and move mounts aren't yet supported with union mounts.
> 
> Are the semantics already set?

Not yet.

> 
> >@@ -294,6 +294,10 @@ static struct vfsmount *clone_mnt(struct
> > 	if (!mnt)
> > 		goto alloc_failed;
> > 
> >+	/*
> >+	 * As of now, cloning of union mounted mnt isn't permitted.
> >+	 */
> >+	BUG_ON(mnt->mnt_flags & MNT_UNION);
> 
> One, please avoid BUG_ONs. Now I am not sure if clone_mnt is called
> as part of kthread creation when CLONE_FS is it. If so, get rid of
> this one real fast. Also see chunk "@@ -1031,.. @@ do_loopback"
> below.

Looks like not CLONE_FS but CLONE_NEWNS ends up calling clone_mnt.

> 
> 	if(mnt->mnt_flags & MNT_UNION)
> 		goto return_einval;
> 
> or something.

Will do this for now, but eventually we need to get this working sanely anyway.

> 
> >+#ifdef CONFIG_UNION_MOUNT
> >+	struct union_info *uinfo = NULL;
> >+#endif
> > 
> > 	retval = security_sb_umount(mnt, flags);
> > 	if (retval)
> >@@ -685,6 +696,14 @@ static int do_umount(struct vfsmount *mn
> > 	}
> > 
> > 	down_write(&namespace_sem);
> >+#ifdef CONFIG_UNION_MOUNT
> >+	/*
> >+	 * Grab a reference to the union_info which gets detached
> >+	 * from the dentries in release_mounts().
> >+	 */
> >+	if (mnt->mnt_flags & MNT_UNION)
> >+		uinfo = union_lock_and_get(mnt->mnt_root);
> >+#endif
> > 	spin_lock(&vfsmount_lock);
> > 	event++;
> > 
> >@@ -699,6 +718,15 @@ static int do_umount(struct vfsmount *mn
> > 		security_sb_umount_busy(mnt);
> > 	up_write(&namespace_sem);
> > 	release_mounts(&umount_list);
> >+#ifdef CONFIG_UNION_MOUNT
> >+	if (uinfo) {
> >+		if (atomic_read(&uinfo->u_count) == 1)
> >+			/* We are the last user of this union_info */
> >+			union_release(uinfo);
> >+		else
> >+			union_put_and_unlock(uinfo);
> >+	}
> >+#endif
> > 	return retval;
> > }
> > 
> 
> Is it feasible to do with with some less #if/#endif magic?:
> 

Will try. We need union_info here which is available only with
CONFIG_UNION_MOUNT.

> >@@ -1031,6 +1070,15 @@ static int do_loopback(struct nameidata 
> > 	if (err)
> > 		return err;
> > 
> >+	/*
> >+	 * bind mounting to or from union mounts is not supported
> >+	 */
> >+	err = -EINVAL;
> >+	if (nd->mnt->mnt_flags & MNT_UNION)
> >+		goto out_unlocked;
> >+	if (old_nd.mnt->mnt_flags & MNT_UNION)
> >+		goto out_unlocked;
> >+
> 
> Do the same in clone_mnt.
> 
> > 	down_write(&namespace_sem);
> > 	err = -EINVAL;
> > 	if (IS_MNT_UNBINDABLE(old_nd.mnt))
> >@@ -1064,6 +1112,7 @@ static int do_loopback(struct nameidata 
> > 
> > out:
> > 	up_write(&namespace_sem);
> >+out_unlocked:
> > 	path_release(&old_nd);
> > 	return err;
> > }
> 
> >+++ b/include/linux/fs.h
> >@@ -1984,6 +1984,9 @@ static inline ino_t parent_ino(struct de
> > /* kernel/fork.c */
> > extern int unshare_files(void);
> > 
> >+/* fs/union.c */
> >+#include <linux/union.h>
> >+
> > /* Transaction based IO helpers */
> > 
> > /*
> 
> This raises a big eyebrow. If linux/fs.h can compile without the
> inclusion of linux/union.h, do not put linux/union.h in fs.h.
> 

Ok, better to include union.h in the appropriate .c file which needs it.

> >+#ifdef CONFIG_UNION_MOUNT
> >+
> >+#include <linux/fs_struct.h>
> >+
> >+/* namespace stuff used at mount time */
> >+extern void attach_mnt_union(struct vfsmount *, struct nameidata *);
> >+extern void detach_mnt_union(struct vfsmount *, struct path *);
> 
> You do not need that #include I suppose. Just predeclare the structs.
> 
> 	struct path;
> 	struct vfsmount;
> 	extern void ...
> 
> Saves us the "compiler slurps in so many .h files" problem.

Sure. And thanks for the review.

Regards,
Bharata.

  reply	other threads:[~2007-05-16  4:57 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-14  9:37 [RFC][PATCH 0/14] VFS based Union Mount(v1) Bharata B Rao
2007-05-14  9:38 ` [RFC][PATCH 1/14] Add union mount documentation Bharata B Rao
2007-05-14  9:39 ` [RFC][PATCH 2/14] Add a new mount flag (MNT_UNION) for union mount Bharata B Rao
2007-05-14 20:38   ` Jan Engelhardt
2007-05-15  8:16     ` Bharata B Rao
2007-05-15 12:06       ` Eric Van Hensbergen
2007-05-15 12:53         ` Jan Blunck
2007-05-14  9:39 ` [RFC][PATCH 3/14] Add the whiteout file type Bharata B Rao
2007-05-14 20:39   ` Jan Engelhardt
2007-05-15  6:00     ` Jan Blunck
2007-05-14  9:40 ` [RFC][PATCH 4/14] Add config options for union mount Bharata B Rao
2007-05-14  9:40 ` [RFC][PATCH 5/14] Introduce union stack Bharata B Rao
2007-05-14 20:23   ` Badari Pulavarty
2007-05-14 20:51     ` Jan Engelhardt
2007-05-19 10:18     ` Paul Dickson
2007-05-22 16:35       ` Jan Engelhardt
2007-05-23 13:25       ` Serge E. Hallyn
2007-05-14 20:48   ` Jan Engelhardt
2007-05-15  7:19     ` Jan Blunck
2007-05-14 22:40   ` Badari Pulavarty
2007-05-15  6:28     ` Bharata B Rao
2007-05-14  9:41 ` [RFC][PATCH 6/14] Union-mount dentry reference counting Bharata B Rao
2007-05-14 20:57   ` Jan Engelhardt
2007-05-14  9:41 ` [RFC][PATCH 7/14] Union-mount mounting Bharata B Rao
2007-05-15  7:29   ` Jan Engelhardt
2007-05-16  5:04     ` Bharata B Rao [this message]
2007-05-14  9:42 ` [RFC][PATCH 8/14] Union-mount lookup Bharata B Rao
2007-05-15  7:57   ` Jan Engelhardt
2007-05-16  5:08     ` Bharata B Rao
2007-05-16 19:28       ` Jan Engelhardt
2007-05-16 20:06         ` Serge E. Hallyn
2007-05-15 14:00   ` Trond Myklebust
2007-05-18 11:05     ` Bharata B Rao
2007-05-14  9:42 ` [RFC][PATCH 9/14] Union-mount readdir Bharata B Rao
2007-05-14 10:43   ` Carsten Otte
2007-05-14 11:15     ` Bharata B Rao
2007-05-14  9:43 ` [RFC][PATCH 10/14] In-kernel file copy between union mounted filesystems Bharata B Rao
2007-05-16  7:57   ` Jan Engelhardt
2007-05-18 11:10     ` Bharata B Rao
2007-05-18 13:47       ` Shaya Potter
2007-05-22  3:13         ` Bharata B Rao
2007-05-22  6:25           ` Jan Engelhardt
2007-05-22  8:38             ` Bharata B Rao
2007-05-22 12:35               ` Shaya Potter
2007-05-23 10:41                 ` Bharata B Rao
2007-05-14  9:43 ` [RFC][PATCH 11/14] VFS whiteout handling Bharata B Rao
2007-05-16  8:06   ` Jan Engelhardt
2007-05-14  9:44 ` [RFC][PATCH 12/14] ext2 whiteout support Bharata B Rao
2007-05-16  8:07   ` Jan Engelhardt
2007-05-14  9:44 ` [RFC][PATCH 13/14] ext3 " Bharata B Rao
2007-05-14 20:16   ` Badari Pulavarty
2007-05-15  6:26     ` Bharata B Rao
2007-05-15  8:31       ` Jan Blunck
2007-05-14 20:17   ` Andreas Dilger
2007-05-14 20:35     ` Jan Blunck
2007-05-15 14:28       ` Theodore Tso
2007-05-14  9:45 ` [RFC][PATCH 14/14] tmpfs " Bharata B Rao
2007-05-14 16:13   ` Hugh Dickins
2007-05-14 19:20     ` Jan Blunck
2007-05-14 19:35       ` Hugh Dickins

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=20070516050408.GA4403@in.ibm.com \
    --to=bharata@linux.vnet.ibm.com \
    --cc=j.blunck@tu-harburg.de \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).