Whamcloud - gitweb
LU-6142 llite: use d_is_symlink to test if dentry is a symlink 70/41770/5
authorMr NeilBrown <neilb@suse.de>
Fri, 16 Oct 2020 00:07:21 +0000 (11:07 +1100)
committerOleg Drokin <green@whamcloud.com>
Mon, 22 Mar 2021 16:25:45 +0000 (16:25 +0000)
Using d_is_symlink() is preferred to testing ->get_link or
->follow_link.

A recent patch made this work for foreign files/dirs by making sure
the entry type in d_flags is correct, so we can simplify the code in
ll_revalidate_dentry().

Fixes: 15d44e787e17 ("LU-12682 llite: fake symlink type of foreign file/dir")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Ie4c33ae1fb9a660ccbd50e2c70b6cde65cc9b990
Reviewed-on: https://review.whamcloud.com/41770
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/dcache.c

index caaacbd..0faaaea 100644 (file)
@@ -295,11 +295,7 @@ static int ll_revalidate_dentry(struct dentry *dentry,
         * 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) {
-#else
-       if (dentry->d_inode && dentry->d_inode->i_op->follow_link) {
-#endif
+       if (d_is_symlink(dentry)) {
                if (!S_ISLNK(dentry->d_inode->i_mode) &&
                    !(lookup_flags & LOOKUP_FOLLOW))
                        return 0;