]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
VFS: ceph: Allow cephwrap_fchmod() to cope with pathref fsps.
authorNoel Power <noel.power@suse.com>
Tue, 6 Apr 2021 16:10:35 +0000 (17:10 +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.

Otherwise fall back to pathname based.

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

index 634222df764b607caa148136fbb91a8db386d2b4..8e6bab0fea70e9e31fbf491431c28a45e1532b65 100644 (file)
@@ -875,7 +875,19 @@ static int cephwrap_fchmod(struct vfs_handle_struct *handle, files_struct *fsp,
        int result;
 
        DBG_DEBUG("[CEPH] fchmod(%p, %p, %d)\n", handle, fsp, mode);
-       result = ceph_fchmod(handle->data, fsp_get_io_fd(fsp), mode);
+       if (!fsp->fsp_flags.is_pathref) {
+               /*
+                * We can use an io_fd to remove xattrs.
+                */
+               result = ceph_fchmod(handle->data, fsp_get_io_fd(fsp), mode);
+       } else {
+               /*
+                * This is no longer a handle based call.
+                */
+               result = ceph_chmod(handle->data,
+                                   fsp->fsp_name->base_name,
+                                   mode);
+       }
        DBG_DEBUG("[CEPH] fchmod(...) = %d\n", result);
        WRAP_RETURN(result);
 }