]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
VFS: ceph: Ensure cephwrap_flistxattr() only uses an io fd for a handle based call.
authorJeremy Allison <jra@samba.org>
Fri, 12 Mar 2021 06:55:33 +0000 (22:55 -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 6eb432e2c98aa414220a76b13733c5e14a8d2553..90dd0355db9acc9920fce6a17bbcdf9c73a70f0d 100644 (file)
@@ -1283,7 +1283,23 @@ static ssize_t cephwrap_flistxattr(struct vfs_handle_struct *handle, struct file
        int ret;
        DBG_DEBUG("[CEPH] flistxattr(%p, %p, %p, %llu)\n",
                  handle, fsp, list, llu(size));
-       ret = ceph_flistxattr(handle->data, fsp_get_io_fd(fsp), list, size);
+       if (!fsp->fsp_flags.is_pathref) {
+               /*
+                * We can use an io_fd to list xattrs.
+                */
+               ret = ceph_flistxattr(handle->data,
+                                       fsp_get_io_fd(fsp),
+                                       list,
+                                       size);
+       } else {
+               /*
+                * This is no longer a handle based call.
+                */
+               ret = ceph_listxattr(handle->data,
+                                       fsp->fsp_name->base_name,
+                                       list,
+                                       size);
+       }
        DBG_DEBUG("[CEPH] flistxattr(...) = %d\n", ret);
        if (ret < 0) {
                WRAP_RETURN(ret);