From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Blunck Subject: Re: [RFC PATCH 2/4] Mount changes to support union mount. Date: Wed, 20 Jun 2007 07:47:11 +0000 (UTC) Message-ID: References: <20070620055050.GB4267@in.ibm.com> <20070620055241.GD4267@in.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: linux-fsdevel@vger.kernel.org To: linux-kernel@vger.kernel.org Return-path: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, 20 Jun 2007 11:22:41 +0530, Bharata B Rao wrote: > +/* > + * When propagating mount events to peer group, this is called under > + * vfsmount_lock. Hence using GFP_ATOMIC for kmalloc here. > + * TODO: Can we use a separate kmem cache for union_mount ? > + */ > +struct union_mount *alloc_union_mount(struct vfsmount *src_mnt, > + struct dentry *src_dentry, struct vfsmount *dst_mnt, > + struct dentry *dst_dentry) > +{ > + struct union_mount *u; > + u = kmalloc(sizeof(struct union_mount), GFP_ATOMIC); > + if (!u) > + return u; > + u->dst_mnt = mntget(dst_mnt); > + u->dst_dentry = dget(dst_dentry); > + u->src_mnt = src_mnt; > + u->src_dentry = dget(src_dentry); > + INIT_LIST_HEAD(&u->hash); > + INIT_LIST_HEAD(&u->list); > + return u; > +} Hmm, you pin the dentries in memory until umount. This isn't good. Besides that this doesn't work with file systems that do invalidate their dentries. The file system must have a chance to replace the dentry in the union structure. Jan