* [patch] add dentry revalidate to follow mount.
@ 2009-06-08 13:44 pravin shelar
2009-06-08 14:13 ` Al Viro
0 siblings, 1 reply; 5+ messages in thread
From: pravin shelar @ 2009-06-08 13:44 UTC (permalink / raw)
To: linux-fsdevel
[-- Attachment #1: Type: text/plain, Size: 333 bytes --]
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
[-- Attachment #2: follow-mount-2630.patch --]
[-- Type: text/x-diff, Size: 1891 bytes --]
Signed-off-by: pravin shelar <pravin.shelar@sun.com>
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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] add dentry revalidate to follow mount.
2009-06-08 13:44 [patch] add dentry revalidate to follow mount pravin shelar
@ 2009-06-08 14:13 ` Al Viro
2009-06-08 20:23 ` pravin shelar
0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2009-06-08 14:13 UTC (permalink / raw)
To: pravin shelar; +Cc: linux-fsdevel
On Mon, Jun 08, 2009 at 07:14:15PM +0530, pravin shelar wrote:
> 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.
... and makes umount() of such thing impossible. NAK. That's not a solution.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] add dentry revalidate to follow mount.
2009-06-08 20:23 ` pravin shelar
@ 2009-06-08 20:17 ` Al Viro
2009-06-09 3:43 ` Andreas Dilger
0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2009-06-08 20:17 UTC (permalink / raw)
To: pravin shelar; +Cc: linux-fsdevel
On Tue, Jun 09, 2009 at 01:53:56AM +0530, pravin shelar wrote:
> Al Viro wrote:
>> On Mon, Jun 08, 2009 at 07:14:15PM +0530, pravin shelar wrote:
>>> 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.
>>
>> ... and makes umount() of such thing impossible. NAK. That's not a solution.
>
> i am not sure how this patch could cause problem for umount. i have
> tested patch with nfs and it worked fine.
> can u elaborate what is problem?
Think what happens if revalidate fails and keeps failing. Would do
wonders to pathname resolution in umount(2)...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] add dentry revalidate to follow mount.
2009-06-08 14:13 ` Al Viro
@ 2009-06-08 20:23 ` pravin shelar
2009-06-08 20:17 ` Al Viro
0 siblings, 1 reply; 5+ messages in thread
From: pravin shelar @ 2009-06-08 20:23 UTC (permalink / raw)
To: Al Viro; +Cc: linux-fsdevel
Al Viro wrote:
> On Mon, Jun 08, 2009 at 07:14:15PM +0530, pravin shelar wrote:
>> 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.
>
> ... and makes umount() of such thing impossible. NAK. That's not a solution.
i am not sure how this patch could cause problem for umount. i have tested patch
with nfs and it worked fine.
can u elaborate what is problem?
thanks,
Pravin.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] add dentry revalidate to follow mount.
2009-06-08 20:17 ` Al Viro
@ 2009-06-09 3:43 ` Andreas Dilger
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Dilger @ 2009-06-09 3:43 UTC (permalink / raw)
To: Al Viro; +Cc: pravin shelar, linux-fsdevel
On Jun 08, 2009 21:17 +0100, Al Viro wrote:
> On Tue, Jun 09, 2009 at 01:53:56AM +0530, pravin shelar wrote:
> > Al Viro wrote:
> >> On Mon, Jun 08, 2009 at 07:14:15PM +0530, pravin shelar wrote:
> >>> 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.
> >>
> >> ... and makes umount() of such thing impossible. NAK. That's not a solution.
> >
> > i am not sure how this patch could cause problem for umount. i have
> > tested patch with nfs and it worked fine.
> > can u elaborate what is problem?
>
> Think what happens if revalidate fails and keeps failing. Would do
> wonders to pathname resolution in umount(2)...
Would having a limit on the number of revalidations be a suitable
compromise?
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-09 3:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-08 13:44 [patch] add dentry revalidate to follow mount pravin shelar
2009-06-08 14:13 ` Al Viro
2009-06-08 20:23 ` pravin shelar
2009-06-08 20:17 ` Al Viro
2009-06-09 3:43 ` Andreas Dilger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).