From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ram Pai Subject: Re: [PATCH] VFS: Clean up shared mount flag propagation Date: Fri, 29 Jan 2010 09:52:17 -0800 Message-ID: <1264787537.6643.144.camel@localhost> References: <20100126192047.GB32353@shell> Reply-To: linuxram@us.ibm.com Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Alexander Viro , linux-fsdevel@vger.kernel.org, Christoph Hellwig , Erez Zadok To: Valerie Aurora Return-path: Received: from e33.co.us.ibm.com ([32.97.110.151]:37547 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752151Ab0A2Rwb (ORCPT ); Fri, 29 Jan 2010 12:52:31 -0500 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e33.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o0THnEwp015597 for ; Fri, 29 Jan 2010 10:49:14 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o0THqSHk212874 for ; Fri, 29 Jan 2010 10:52:28 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o0THqJgA001230 for ; Fri, 29 Jan 2010 10:52:19 -0700 In-Reply-To: <20100126192047.GB32353@shell> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, 2010-01-26 at 14:20 -0500, Valerie Aurora wrote: > Al, you might have already fixed this as part of your mount flag > rewrite, but here's a patch to clean up some problems with shared > mount flag propagation that I ran into while working on union mounts. > Against 2.6.32. > > -VAL > > commit 3f436c4466f278900d451494b317f6bb80b4c24b > Author: Valerie Aurora > Date: Tue Jan 26 11:09:00 2010 -0800 > > VFS: Clean up shared mount flag propagation > > The handling of mount flags in set_mnt_shared() got a little tangled > up during previous cleanups, with the following problems: > > * MNT_PNODE_MASK is defined as a literal constant when it should be a > bitwise xor of other MNT_* flags > * set_mnt_shared() clears and then sets MNT_SHARED (part of MNT_PNODE_MASK) > * MNT_PNODE_MASK could use a comment in mount.h > * MNT_PNODE_MASK is a terrible name, change to MNT_SHARED_MASK > > This patch fixes these problems. > > diff --git a/fs/pnode.h b/fs/pnode.h > index 958665d..adc52ca 100644 > --- a/fs/pnode.h > +++ b/fs/pnode.h > @@ -26,7 +26,7 @@ > > static inline void set_mnt_shared(struct vfsmount *mnt) > { > - mnt->mnt_flags &= ~MNT_PNODE_MASK; > + mnt->mnt_flags &= ~MNT_SHARED_MASK; > mnt->mnt_flags |= MNT_SHARED; > } > Is resetting the MNT_SHARED bit and setting it back, causing a issue? If so, why not just do - mnt->mnt_flags &= ~MNT_PNODE_MASK; + mnt->mnt_flags &= ~MNT_UNBINDABLE; > diff --git a/include/linux/mount.h b/include/linux/mount.h > index 5d52753..257985f 100644 > --- a/include/linux/mount.h > +++ b/include/linux/mount.h > @@ -34,7 +34,15 @@ 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 /* propagation flag mask */ I prefer to leave the name MNT_PNODE_MASK as is, because it captures the notion of propagation v/s the notion of just being shared. > +/* > + * MNT_SHARED_MASK is the set of flags that should be cleared when a > + * mount becomes shared. Currently, this is only the flag that says a > + * mount cannot be bind mounted, since this is how we create a mount > + * that shares events with another mount. If you add a new MNT_* > + * flag, consider how it interacts with shared mounts. > + */ > +#define MNT_SHARED_MASK (MNT_UNBINDABLE) and make this +#define MNT_SHARED_MASK (MNT_UNBINDABLE | MNT_SHARED) RP > + > > struct vfsmount { > struct list_head mnt_hash; -- Ram Pai System X Device-Driver Enablement Lead Linux Technology Center Beaverton OR-97006 503-5783752 t/l 7753752 linuxram@us.ibm.com