linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Jan Blunck <j.blunck@tu-harburg.de>
Subject: [RFC][PATCH  2/14] Add a new mount flag (MNT_UNION) for union mount
Date: Mon, 14 May 2007 15:09:02 +0530	[thread overview]
Message-ID: <20070514093902.GD4139@in.ibm.com> (raw)
In-Reply-To: <20070514093722.GB4139@in.ibm.com>

From: Jan Blunck <j.blunck@tu-harburg.de>
Subject: Add a new mount flag (MNT_UNION) for union mount.

Introduce MNT_UNION, MS_UNION and FS_WHT flags. There are the necessary flags
for doing

    mount /dev/hda3 /mnt -o union

You need additional patches for util-linux for that to work.

Signed-off-by: Jan Blunck <j.blunck@tu-harburg.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
 fs/namespace.c        |   14 +++++++++++++-
 include/linux/fs.h    |    2 ++
 include/linux/mount.h |    1 +
 3 files changed, 16 insertions(+), 1 deletion(-)

--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -442,6 +442,7 @@ static int show_vfsmnt(struct seq_file *
 		{ MNT_NODIRATIME, ",nodiratime" },
 		{ MNT_RELATIME, ",relatime" },
 		{ MNT_NOMNT, ",nomnt" },
+		{ MNT_UNION, ",union" },
 		{ 0, NULL }
 	};
 	struct proc_fs_info *fs_infop;
@@ -1256,6 +1257,14 @@ int do_add_mount(struct vfsmount *newmnt
 	if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))
 		goto unlock;
 
+	/* Unions couldn't be writable if the filesystem
+	 * doesn't know about whiteouts */
+	err = -ENOTSUPP;
+	if ((mnt_flags & MNT_UNION) &&
+	    !(newmnt->mnt_sb->s_flags & MS_RDONLY) &&
+	    !(newmnt->mnt_sb->s_type->fs_flags & FS_WHT))
+		goto unlock;
+
 	/* some flags may have been set earlier */
 	newmnt->mnt_flags |= mnt_flags;
 	if ((err = graft_tree(newmnt, nd)))
@@ -1562,9 +1571,12 @@ long do_mount(char *dev_name, char *dir_
 		mnt_flags |= MNT_RELATIME;
 	if (flags & MS_NOMNT)
 		mnt_flags |= MNT_NOMNT;
+	if (flags & MS_UNION)
+		mnt_flags |= MNT_UNION;
 
 	flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
-		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME | MS_NOMNT);
+		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME | MS_NOMNT |
+		   MS_UNION);
 
 	/* ... and get the mountpoint */
 	retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd);
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -97,6 +97,7 @@ extern int dir_notify_enable;
 #define FS_BINARY_MOUNTDATA 2
 #define FS_HAS_SUBTYPE 4
 #define FS_SAFE 8		/* Safe to mount by unprivileged users */
+#define FS_WHT	16
 #define FS_REVAL_DOT	16384	/* Check the paths ".", ".." for staleness */
 #define FS_RENAME_DOES_D_MOVE	32768	/* FS will handle d_move()
 					 * during rename() internally.
@@ -113,6 +114,7 @@ extern int dir_notify_enable;
 #define MS_REMOUNT	32	/* Alter flags of a mounted FS */
 #define MS_MANDLOCK	64	/* Allow mandatory locks on an FS */
 #define MS_DIRSYNC	128	/* Directory modifications are synchronous */
+#define MS_UNION	256	/* Union mount */
 #define MS_NOATIME	1024	/* Do not update access times. */
 #define MS_NODIRATIME	2048	/* Do not update directory access times */
 #define MS_BIND		4096
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -36,6 +36,7 @@ struct mnt_namespace;
 #define MNT_SHARED	0x1000	/* if the vfsmount is a shared mount */
 #define MNT_UNBINDABLE	0x2000	/* if the vfsmount is a unbindable mount */
 #define MNT_PNODE_MASK	0x3000	/* propogation flag mask */
+#define MNT_UNION	0x4000	/* if the vfsmount is a union mount */
 
 struct vfsmount {
 	struct list_head mnt_hash;

  parent reply	other threads:[~2007-05-14  9:39 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 ` Bharata B Rao [this message]
2007-05-14 20:38   ` [RFC][PATCH 2/14] Add a new mount flag (MNT_UNION) for union mount 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
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=20070514093902.GD4139@in.ibm.com \
    --to=bharata@linux.vnet.ibm.com \
    --cc=j.blunck@tu-harburg.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).