Skip to content

Commit e0caaf7

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
NFS: LOOKUP_DIRECTORY is also ok with symlinks
Commit ac79516 (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: ac79516 ("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>
1 parent 9d047bf commit e0caaf7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/nfs/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,14 +2010,14 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
20102010
if (!res) {
20112011
inode = d_inode(dentry);
20122012
if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
2013-
!S_ISDIR(inode->i_mode))
2013+
!(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
20142014
res = ERR_PTR(-ENOTDIR);
20152015
else if (inode && S_ISREG(inode->i_mode))
20162016
res = ERR_PTR(-EOPENSTALE);
20172017
} else if (!IS_ERR(res)) {
20182018
inode = d_inode(res);
20192019
if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
2020-
!S_ISDIR(inode->i_mode)) {
2020+
!(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) {
20212021
dput(res);
20222022
res = ERR_PTR(-ENOTDIR);
20232023
} else if (inode && S_ISREG(inode->i_mode)) {

0 commit comments

Comments
 (0)