From mboxrd@z Thu Jan 1 00:00:00 1970 From: Valerie Aurora Subject: [PATCH 24/74] union-mount: Introduce MNT_UNION and MS_UNION flags Date: Tue, 22 Mar 2011 18:59:00 -0700 Message-ID: <1300845590-14184-25-git-send-email-valerie.aurora@gmail.com> References: <1300845590-14184-1-git-send-email-valerie.aurora@gmail.com> Cc: viro@zeniv.linux.org.uk, Jan Blunck , Valerie Aurora , Valerie Aurora To: linux-fsdevel@vger.kernel.org, linux@vger.kernel.org Return-path: Received: from mail-iw0-f174.google.com ([209.85.214.174]:57072 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756286Ab1CWCB0 (ORCPT ); Tue, 22 Mar 2011 22:01:26 -0400 In-Reply-To: <1300845590-14184-1-git-send-email-valerie.aurora@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Jan Blunck Add per mountpoint flag for Union Mount support. You need additional patches to util-linux for that to work - see: git://git.kernel.org/pub/scm/utils/util-linux-ng/val/util-linux-ng.git Signed-off-by: Jan Blunck Signed-off-by: Valerie Aurora Signed-off-by: Valerie Aurora --- fs/namespace.c | 5 ++++- include/linux/fs.h | 1 + include/linux/mount.h | 1 + 3 files changed, 6 insertions(+), 1 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 0f028e0..054eb7d 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -862,6 +862,7 @@ static void show_mnt_opts(struct seq_file *m, struct vfsmount *mnt) { MNT_NOATIME, ",noatime" }, { MNT_NODIRATIME, ",nodiratime" }, { MNT_RELATIME, ",relatime" }, + { MNT_UNION, ",union" }, { 0, NULL } }; const struct proc_fs_info *fs_infop; @@ -2095,10 +2096,12 @@ long do_mount(char *dev_name, char *dir_name, char *type_page, mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME); if (flags & MS_RDONLY) mnt_flags |= MNT_READONLY; + if (flags & MS_UNION) + mnt_flags |= MNT_UNION; flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN | MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | - MS_STRICTATIME); + MS_STRICTATIME | MS_UNION); if (flags & MS_REMOUNT) retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags, diff --git a/include/linux/fs.h b/include/linux/fs.h index 469e0ea..dad9903 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -191,6 +191,7 @@ struct inodes_stat_t { #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 /* Merge namespace with FS mounted below */ #define MS_NOATIME 1024 /* Do not update access times. */ #define MS_NODIRATIME 2048 /* Do not update directory access times */ #define MS_BIND 4096 diff --git a/include/linux/mount.h b/include/linux/mount.h index 44aa119..1c69bee 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -46,6 +46,7 @@ struct mnt_namespace; #define MNT_INTERNAL 0x4000 #define MNT_HARD_READONLY 0x8000 /* has a hard read-only ref on the sb */ +#define MNT_UNION 0x10000 /* top layer of a union mount */ struct vfsmount { struct list_head mnt_hash; -- 1.7.0.4