]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
VFS: we need to set LOOKUP_JUMPED on mountpoint crossing
authorAl Viro <viro@ZenIV.linux.org.uk>
Mon, 7 Nov 2011 21:21:26 +0000 (21:21 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:37:08 +0000 (09:37 -0800)
commit656460cd7714653cf60a10c79e02cbfe2d9bf732
treea9eb6dd3de35c760ae5d327fd121a7e0ce78c8fb
parent0447f4d5654bb5d95008f16dad839104f8d0d39a
VFS: we need to set LOOKUP_JUMPED on mountpoint crossing

commit a3fbbde70a0cec017f2431e8f8de208708c76acc upstream.

Mountpoint crossing is similar to following procfs symlinks - we do
not get ->d_revalidate() called for dentry we have arrived at, with
unpleasant consequences for NFS4.

Simple way to reproduce the problem in mainline:

    cat >/tmp/a.c <<'EOF'
    #include <unistd.h>
    #include <fcntl.h>
    #include <stdio.h>
    main()
    {
            struct flock fl = {.l_type = F_RDLCK, .l_whence = SEEK_SET, .l_len = 1};
            if (fcntl(0, F_SETLK, &fl))
                    perror("setlk");
    }
    EOF
    cc /tmp/a.c -o /tmp/test

then on nfs4:

    mount --bind file1 file2
    /tmp/test < file1 # ok
    /tmp/test < file2 # spews "setlk: No locks available"...

What happens is the missing call of ->d_revalidate() after mountpoint
crossing and that's where NFS4 would issue OPEN request to server.

The fix is simple - treat mountpoint crossing the same way we deal with
following procfs-style symlinks.  I.e.  set LOOKUP_JUMPED...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/namei.c