From 17995af6b82d27f22f444cdff9b4399fdd4c869c Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Tue, 12 Nov 2019 19:58:43 +0530 Subject: [PATCH] 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 --- source3/modules/vfs_glusterfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 6d087c0b4d4..b1b73617edc 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -564,7 +564,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); -- 2.23.0