From: Anoop C S Date: Tue, 12 Nov 2019 14:28:43 +0000 (+0530) Subject: s3: VFS: glusterfs: Reset nlinks for symlink entries during readdir X-Git-Tag: samba-4.10.13~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5e8ba021bfeb98275d2d739cf9cbb4893d81997;p=thirdparty%2Fsamba.git s3: VFS: glusterfs: Reset nlinks for symlink entries during readdir 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 Reviewed-by: Günther Deschner Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Dec 17 21:53:07 UTC 2019 on sn-devel-184 (cherry picked from commit fca2d3e0d1fa5af59e7b729f7c1d126f7b81e149) Autobuild-User(v4-10-test): Karolin Seeger Autobuild-Date(v4-10-test): Thu Dec 19 13:46:00 UTC 2019 on sn-devel-144 --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index f2f9ab8e32c..cf51f5dd06b 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -560,7 +560,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);