Whamcloud - gitweb
LU-12682 llite: fake symlink type of foreign file/dir
[fs/lustre-release.git] / lustre / llite / dcache.c
index c299068..c76382f 100644 (file)
@@ -294,12 +294,22 @@ static int ll_revalidate_dentry(struct dentry *dentry,
                return 1;
 
        /* Symlink - always valid as long as the dentry was found */
+       /* only special case is to prevent ELOOP error from VFS during open
+        * of a foreign symlink file/dir with O_NOFOLLOW, like it happens for
+        * real symlinks. This will allow to open foreign symlink file/dir
+        * for get[dir]stripe/unlock ioctl()s.
+        */
 #ifdef HAVE_IOP_GET_LINK
-       if (dentry->d_inode && dentry->d_inode->i_op->get_link)
+       if (dentry->d_inode && dentry->d_inode->i_op->get_link) {
 #else
-       if (dentry->d_inode && dentry->d_inode->i_op->follow_link)
+       if (dentry->d_inode && dentry->d_inode->i_op->follow_link) {
 #endif
-               return 1;
+               if (!S_ISLNK(dentry->d_inode->i_mode) &&
+                   !(lookup_flags & LOOKUP_FOLLOW))
+                       return 0;
+               else
+                       return 1;
+       }
 
        /*
         * VFS warns us that this is the second go around and previous