VFS: gluster: Allow vfs_gluster_fchmod() to cope with pathref fsps.
authorNoel Power <noel.power@suse.com>
Tue, 6 Apr 2021 16:08:50 +0000 (17:08 +0100)
committerNoel Power <npower@samba.org>
Sun, 11 Apr 2021 22:27:34 +0000 (22:27 +0000)
Ensure it only uses an io fd for a handle based call.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_glusterfs.c

index 5a36b94c41bcfee635da642f5f80fd6edaaba5e0..ef52f83f9bcd32f665dc98c453c758f8623a79de 100644 (file)
@@ -1486,7 +1486,17 @@ static int vfs_gluster_fchmod(struct vfs_handle_struct *handle,
                return -1;
        }
 
-       ret = glfs_fchmod(glfd, mode);
+       if (!fsp->fsp_flags.is_pathref) {
+               /*
+                * We can use an io_fd to remove xattrs.
+                */
+               ret = glfs_fchmod(glfd, mode);
+       } else {
+               /*
+                * This is no longer a handle based call.
+                */
+               ret = glfs_chmod(handle->data, fsp->fsp_name->base_name, mode);
+       }
        END_PROFILE(syscall_fchmod);
 
        return ret;