From mboxrd@z Thu Jan 1 00:00:00 1970 From: pravin shelar Subject: [patch] add dentry revalidate to follow mount. Date: Mon, 08 Jun 2009 19:14:15 +0530 Message-ID: <4A2D15AF.8090000@sun.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_YLYYzcV6pkUg/Cf0SccR5g)" To: linux-fsdevel@vger.kernel.org Return-path: Received: from sineb-mail-1.sun.com ([192.18.19.6]:36221 "EHLO sineb-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754248AbZFHNlR (ORCPT ); Mon, 8 Jun 2009 09:41:17 -0400 Received: from fe-apac-05.sun.com (fe-apac-05.sun.com [192.18.19.176] (may be forged)) by sineb-mail-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id n58Da34Z016407 for ; Mon, 8 Jun 2009 13:36:16 GMT Received: from conversion-daemon.mail-apac.sun.com by mail-apac.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009)) id <0KKX00I009RY5V00@mail-apac.sun.com> for linux-fsdevel@vger.kernel.org; Mon, 08 Jun 2009 21:36:03 +0800 (SGT) Received: from [192.168.1.2] ([unknown] [59.95.55.78]) by mail-apac.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009)) with ESMTPSA id <0KKX0008M9S1E8E0@mail-apac.sun.com> for linux-fsdevel@vger.kernel.org; Mon, 08 Jun 2009 21:36:03 +0800 (SGT) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --Boundary_(ID_YLYYzcV6pkUg/Cf0SccR5g) Content-type: text/plain; CHARSET=US-ASCII; format=flowed Content-transfer-encoding: 7BIT Hi i have seen error in lustre while setting permission on fs root from a client. problem is permission are not getting propagated to other clients. this is because of do_lookup() call path which does not revalidate fs root dentry in follow_mount() attached patch adds revalidation call in follow_mount. Thanks, Pravin --Boundary_(ID_YLYYzcV6pkUg/Cf0SccR5g) Content-type: text/x-diff; name=follow-mount-2630.patch Content-transfer-encoding: 7BIT Content-disposition: inline; filename=follow-mount-2630.patch Signed-off-by: pravin shelar Index: linux-2.6-latest/fs/namei.c =================================================================== --- linux-2.6-latest.orig/fs/namei.c +++ linux-2.6-latest/fs/namei.c @@ -691,9 +691,11 @@ int follow_up(struct vfsmount **mnt, str /* no need for dcache_lock, as serialization is taken care in * namespace.c */ -static int __follow_mount(struct path *path) +static int __follow_mount(struct nameidata *nd, struct path *path) { int res = 0; + struct dentry *dentry; + while (d_mountpoint(path->dentry)) { struct vfsmount *mounted = lookup_mnt(path->mnt, path->dentry); if (!mounted) @@ -703,6 +705,18 @@ static int __follow_mount(struct path *p mntput(path->mnt); path->mnt = mounted; path->dentry = dget(mounted->mnt_root); + dentry = path->dentry; + + if (dentry->d_op && dentry->d_op->d_revalidate){ + dentry = do_revalidate(dentry, nd); + if (!dentry) + return -EINVAL; + if (IS_ERR(dentry)) + return PTR_ERR(dentry); + } + + path->dentry = dentry; + res = 1; } return res; @@ -788,6 +802,7 @@ static int do_lookup(struct nameidata *n { struct vfsmount *mnt = nd->path.mnt; struct dentry *dentry = __d_lookup(nd->path.dentry, name); + int rc; if (!dentry) goto need_lookup; @@ -796,7 +811,9 @@ static int do_lookup(struct nameidata *n done: path->mnt = mnt; path->dentry = dentry; - __follow_mount(path); + rc = __follow_mount(nd, path); + if (rc < 0) + return rc; return 0; need_lookup: @@ -1747,11 +1764,15 @@ do_last: if (flag & O_EXCL) goto exit_dput; - if (__follow_mount(&path)) { - error = -ELOOP; - if (flag & O_NOFOLLOW) + error = __follow_mount(&nd, &path); + if (error == 1) { + if (flag & O_NOFOLLOW) { + error = -ELOOP; goto exit_dput; + } } + if (error < 0) + goto exit_dput; error = -ENOENT; if (!path.dentry->d_inode) --Boundary_(ID_YLYYzcV6pkUg/Cf0SccR5g)--