]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: glusterfs: Reset nlinks for symlink entries during readdir
authorAnoop C S <anoopcs@redhat.com>
Tue, 12 Nov 2019 14:28:43 +0000 (19:58 +0530)
committerJeremy Allison <jra@samba.org>
Tue, 17 Dec 2019 21:53:07 +0000 (21:53 +0000)
On receiving an already initialized stat_ex buffer for readdir() call we
invoke readdirplus() GlusterFS API, an optimized variant of readdir(),
which then returns stat information along with dir entry result. But for
symlink entries we don't know if link or target info is needed. In that
case it is better to leave this decision back to caller by resetting
nlinks value inside stat information to make it invalid.

This was also preventing us from displaying msdfs link as directories
inside the share.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14182

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 17 21:53:07 UTC 2019 on sn-devel-184

source3/modules/vfs_glusterfs.c

index 6c3995b716819c597c980c0341997ebaa7988218..d7a1ec4d3347e8f37626e5c7fcf7bef8d87be6c8 100644 (file)
@@ -573,7 +573,10 @@ static struct dirent *vfs_gluster_readdir(struct vfs_handle_struct *handle,
        }
 
        if (sbuf != NULL) {
-               smb_stat_ex_from_stat(sbuf, &stat);
+               SET_STAT_INVALID(*sbuf);
+               if (!S_ISLNK(stat.st_mode)) {
+                       smb_stat_ex_from_stat(sbuf, &stat);
+               }
        }
 
        END_PROFILE(syscall_readdir);