Re: [PATCH] NFS: LOOKUP_DIRECTORY is also ok with symlinks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



#regzbot monitor: https://lore.kernel.org/linux-nfs/20220208183823.1391397-1-trondmy@xxxxxxxxxx/

Dear Trond,


Am 09.02.22 um 23:02 schrieb Paul Menzel:

Am 08.02.22 um 19:38 schrieb trondmy@xxxxxxxxxx:
From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
Fixes: ac795161c936 ("NFSv4: Handle case where the lookup of a directory fails")
Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>

Thank you for fixing it so quickly. My colleague verified, that it fixes our issue.

Tested-by: Donald Buczek <buczek@xxxxxxxxxxxxx>

Also for regzbot:

Link: https://lore.kernel.org/linux-nfs/0235e04a-18aa-ccbf-f520-38a2d55e8b54@xxxxxxxxxxxxx/


Kind regards,

Paul


---
  fs/nfs/dir.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index e128503728f2..6dee4e12d381 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2051,14 +2051,14 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
      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)) {



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux