]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
VFS: ceph: Ensure cephwrap_fsetxattr() only uses an io fd for a handle based call.
authorJeremy Allison <jra@samba.org>
Fri, 12 Mar 2021 07:00:14 +0000 (23:00 -0800)
committerJeremy Allison <jra@samba.org>
Fri, 12 Mar 2021 19:25:34 +0000 (19:25 +0000)
Otherwise fall back to pathname based. This is the same as the
fallback used in vfs_default.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_ceph.c

index 90dd0355db9acc9920fce6a17bbcdf9c73a70f0d..e2f3691bc4fb3ff9539f6caf7defc5edc05ae685 100644 (file)
@@ -1332,8 +1332,27 @@ static int cephwrap_fsetxattr(struct vfs_handle_struct *handle, struct files_str
 {
        int ret;
        DBG_DEBUG("[CEPH] fsetxattr(%p, %p, %s, %p, %llu, %d)\n", handle, fsp, name, value, llu(size), flags);
-       ret = ceph_fsetxattr(handle->data, fsp_get_io_fd(fsp),
-                            name, value, size, flags);
+       if (!fsp->fsp_flags.is_pathref) {
+               /*
+                * We can use an io_fd to set xattrs.
+                */
+               ret = ceph_fsetxattr(handle->data,
+                               fsp_get_io_fd(fsp),
+                               name,
+                               value,
+                               size,
+                               flags);
+       } else {
+               /*
+                * This is no longer a handle based call.
+                */
+               ret = ceph_setxattr(handle->data,
+                               fsp->fsp_name->base_name,
+                               name,
+                               value,
+                               size,
+                               flags);
+       }
        DBG_DEBUG("[CEPH] fsetxattr(...) = %d\n", ret);
        WRAP_RETURN(ret);
 }