mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
NFS: LOOKUP_DIRECTORY is also ok with symlinks
commite0caaf75d4upstream. Commitac795161c9(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:ac795161c9("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: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
598dbaf74b
commit
f9b7385c0f
@@ -1780,14 +1780,14 @@ no_open:
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
inode = d_inode(dentry);
|
inode = d_inode(dentry);
|
||||||
if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
|
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);
|
res = ERR_PTR(-ENOTDIR);
|
||||||
else if (inode && S_ISREG(inode->i_mode))
|
else if (inode && S_ISREG(inode->i_mode))
|
||||||
res = ERR_PTR(-EOPENSTALE);
|
res = ERR_PTR(-EOPENSTALE);
|
||||||
} else if (!IS_ERR(res)) {
|
} else if (!IS_ERR(res)) {
|
||||||
inode = d_inode(res);
|
inode = d_inode(res);
|
||||||
if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
|
if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
|
||||||
!S_ISDIR(inode->i_mode)) {
|
!(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) {
|
||||||
dput(res);
|
dput(res);
|
||||||
res = ERR_PTR(-ENOTDIR);
|
res = ERR_PTR(-ENOTDIR);
|
||||||
} else if (inode && S_ISREG(inode->i_mode)) {
|
} else if (inode && S_ISREG(inode->i_mode)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user