lkml.org 
[lkml]   [2005]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: NFS: NFS3 lookup fails if creating a file with O_EXCL & multiple mountpoints in pathname
From
Date
må den 06.06.2005 Klokka 22:29 (-0400) skreiv Linda Dunaphant:
> Hi Trond,
>
> One of our applications was doing an open on a NFS client with the flags
> set for O_WRONLY|O_CREAT|O_EXCL|0x4. There are numerous symlinks in the
> pathname for the file that go into two different NFS filesystems. The
> file create works properly if the filesystems are mounted as NFS2, but
> it fails with NFS3 mounts.
>
> In nfs_lookup() there is a check to see if it is an exclusive create.
> If it is exclusive, nfs_lookup() bypasses ("optimizes" away) the rest
> of the lookup. When the problem occurs, I see it stop the lookup too
> early. This only occurs when the basename portion of the pathname is
> not currently in the NFS cache from a previous non- O_EXCL pathname lookup.
>
> The nfs_is_exclusive_create() was returning TRUE, even when the
> search wasn't at the last pathname component. This occurred because
> the LOOKUP_CONTINUE flag is reset when it crosses the second
> mountpoint into the NFS filesystem. nfs_is_exclusive_create() was
> trying to use this flag to determine if it was at the end point
> of the pathname search. Since it was reset when it crossed the
> mountpoint boundary, it returned TRUE several pathname levels too
> early.

Then the correct fix here is to fix the LOOKUP_CONTINUE flag so that it
is set in the above situations.

> I changed the nfs_is_exclusive_create() to use the LOOKUP_PARENT
> flag instead of the LOOKUP_CONTINUE flag. I found that LOOKUP_PARENT
> stays set until you get to the very last pathname level, which is
> the correct point for it to check whether it is an exclusive create.

Vetoed. LOOKUP_PARENT and LOOKUP_CONTINUE are _very_ different flags.
The former tells you what the goal of the lookup operation is. The
latter tells you about the current state of the lookup operation (namely
whether or not the VFS thinks it is on the last element of the path
lookup).

Cheers,
Trond

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-06-07 05:06    [W:0.034 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site