diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2022-02-08 13:38:23 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-02-23 11:58:40 +0100 |
commit | 67552482aee7a139ed957595db8668d28ddc2c42 (patch) | |
tree | b263b52caaa9a649e91264df4f72afe4c7af6d79 /fs | |
parent | 38c7f8c0599a04547f9be3be66e7b7e64d71c918 (diff) | |
download | linux-stable-67552482aee7a139ed957595db8668d28ddc2c42.tar.gz linux-stable-67552482aee7a139ed957595db8668d28ddc2c42.tar.bz2 linux-stable-67552482aee7a139ed957595db8668d28ddc2c42.zip |
NFS: LOOKUP_DIRECTORY is also ok with symlinks
commit e0caaf75d443e02e55e146fd75fe2efc8aed5540 upstream.
Commit ac795161c936 (NFSv4: Handle case where the lookup of a directory
fails) [1], part of Linux since 5.17-rc2, introduced a regression, where
a symbolic link on an NFS mount to a directory on another NFS does not
resolve(?) the first time it is accessed:
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Fixes: ac795161c936 ("NFSv4: Handle case where the lookup of a directory fails")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Tested-by: Donald Buczek <buczek@molgen.mpg.de>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index a968b8b4b982..10bc04af2882 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1629,14 +1629,14 @@ no_open: if (!res) { inode = d_inode(dentry); if ((lookup_flags & LOOKUP_DIRECTORY) && inode && - !S_ISDIR(inode->i_mode)) + !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) res = ERR_PTR(-ENOTDIR); else if (inode && S_ISREG(inode->i_mode)) res = ERR_PTR(-EOPENSTALE); } else if (!IS_ERR(res)) { inode = d_inode(res); if ((lookup_flags & LOOKUP_DIRECTORY) && inode && - !S_ISDIR(inode->i_mode)) { + !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) { dput(res); res = ERR_PTR(-ENOTDIR); } else if (inode && S_ISREG(inode->i_mode)) { |