From mboxrd@z Thu Jan 1 00:00:00 1970 From: Valerie Aurora Subject: [PATCH 02/34] VFS: Add CL_NO_SHARED flag to clone_mnt()/copy_tree() Date: Thu, 16 Sep 2010 15:11:53 -0700 Message-ID: <1284675145-4391-3-git-send-email-vaurora@redhat.com> References: <1284675145-4391-1-git-send-email-vaurora@redhat.com> Cc: Miklos Szeredi , Christoph Hellwig , Andreas Gruenbacher , Nick Piggin , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Valerie Aurora To: Alexander Viro Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754858Ab0IPWOS (ORCPT ); Thu, 16 Sep 2010 18:14:18 -0400 In-Reply-To: <1284675145-4391-1-git-send-email-vaurora@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Passing the CL_NO_SHARED flag to clone_mnt() causes the clone to fail if the source mnt is shared. Signed-off-by: Valerie Aurora --- fs/namespace.c | 3 +++ fs/pnode.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 5566524..eeb4c22 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -562,6 +562,9 @@ static struct vfsmount *clone_mnt(struct vfsmount *old, struct dentry *root, struct vfsmount *mnt; int err; + if ((flag & CL_NO_SHARED) && (IS_MNT_SHARED(old))) + return ERR_PTR(-EINVAL); + mnt = alloc_vfsmnt(old->mnt_devname); if (!mnt) return ERR_PTR(-ENOMEM); diff --git a/fs/pnode.h b/fs/pnode.h index 1ea4ae1..bcb3c47 100644 --- a/fs/pnode.h +++ b/fs/pnode.h @@ -22,6 +22,7 @@ #define CL_COPY_ALL 0x04 #define CL_MAKE_SHARED 0x08 #define CL_PRIVATE 0x10 +#define CL_NO_SHARED 0x20 static inline void set_mnt_shared(struct vfsmount *mnt) { -- 1.6.3.3