mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
Merge PR #38355 into master
* refs/pull/38355/head: client: when STATX_NLINK is requested request FsLs caps client: ensure we take Fs caps when querying dirstat vxattrs Reviewed-by: Xiubo Li <xiubli@redhat.com>
This commit is contained in:
commit
b661dbf2ba
@ -7604,7 +7604,7 @@ unsigned Client::statx_to_mask(unsigned int flags, unsigned int want)
|
||||
mask |= CEPH_CAP_AUTH_SHARED;
|
||||
if (want & (CEPH_STATX_NLINK|CEPH_STATX_CTIME|CEPH_STATX_VERSION))
|
||||
mask |= CEPH_CAP_LINK_SHARED;
|
||||
if (want & (CEPH_STATX_ATIME|CEPH_STATX_MTIME|CEPH_STATX_CTIME|CEPH_STATX_SIZE|CEPH_STATX_BLOCKS|CEPH_STATX_VERSION))
|
||||
if (want & (CEPH_STATX_NLINK|CEPH_STATX_ATIME|CEPH_STATX_MTIME|CEPH_STATX_CTIME|CEPH_STATX_SIZE|CEPH_STATX_BLOCKS|CEPH_STATX_VERSION))
|
||||
mask |= CEPH_CAP_FILE_SHARED;
|
||||
if (want & (CEPH_STATX_VERSION|CEPH_STATX_CTIME))
|
||||
mask |= CEPH_CAP_XATTR_SHARED;
|
||||
@ -11821,6 +11821,9 @@ int Client::_getxattr(Inode *in, const char *name, void *value, size_t size,
|
||||
if (vxattr->flags & VXATTR_RSTAT) {
|
||||
flags |= CEPH_STAT_RSTAT;
|
||||
}
|
||||
if (vxattr->flags & VXATTR_DIRSTAT) {
|
||||
flags |= CEPH_CAP_FILE_SHARED;
|
||||
}
|
||||
r = _getattr(in, flags | CEPH_STAT_CAP_XATTR, perms, true);
|
||||
if (r != 0) {
|
||||
// Error from getattr!
|
||||
@ -12392,15 +12395,7 @@ size_t Client::_vxattrcb_client_id(Inode *in, char *val, size_t size)
|
||||
#define CEPH_XATTR_NAME(_type, _name) "ceph." #_type "." #_name
|
||||
#define CEPH_XATTR_NAME2(_type, _name, _name2) "ceph." #_type "." #_name "." #_name2
|
||||
|
||||
#define XATTR_NAME_CEPH(_type, _name) \
|
||||
{ \
|
||||
name: CEPH_XATTR_NAME(_type, _name), \
|
||||
getxattr_cb: &Client::_vxattrcb_ ## _type ## _ ## _name, \
|
||||
readonly: true, \
|
||||
exists_cb: NULL, \
|
||||
flags: 0, \
|
||||
}
|
||||
#define XATTR_NAME_CEPH2(_type, _name, _flags) \
|
||||
#define XATTR_NAME_CEPH(_type, _name, _flags) \
|
||||
{ \
|
||||
name: CEPH_XATTR_NAME(_type, _name), \
|
||||
getxattr_cb: &Client::_vxattrcb_ ## _type ## _ ## _name, \
|
||||
@ -12438,15 +12433,15 @@ const Client::VXattr Client::_dir_vxattrs[] = {
|
||||
XATTR_LAYOUT_FIELD(dir, layout, object_size),
|
||||
XATTR_LAYOUT_FIELD(dir, layout, pool),
|
||||
XATTR_LAYOUT_FIELD(dir, layout, pool_namespace),
|
||||
XATTR_NAME_CEPH(dir, entries),
|
||||
XATTR_NAME_CEPH(dir, files),
|
||||
XATTR_NAME_CEPH(dir, subdirs),
|
||||
XATTR_NAME_CEPH2(dir, rentries, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH2(dir, rfiles, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH2(dir, rsubdirs, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH2(dir, rsnaps, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH2(dir, rbytes, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH2(dir, rctime, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH(dir, entries, VXATTR_DIRSTAT),
|
||||
XATTR_NAME_CEPH(dir, files, VXATTR_DIRSTAT),
|
||||
XATTR_NAME_CEPH(dir, subdirs, VXATTR_DIRSTAT),
|
||||
XATTR_NAME_CEPH(dir, rentries, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH(dir, rfiles, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH(dir, rsubdirs, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH(dir, rsnaps, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH(dir, rbytes, VXATTR_RSTAT),
|
||||
XATTR_NAME_CEPH(dir, rctime, VXATTR_RSTAT),
|
||||
{
|
||||
name: "ceph.quota",
|
||||
getxattr_cb: &Client::_vxattrcb_quota,
|
||||
|
@ -1164,6 +1164,7 @@ private:
|
||||
|
||||
/* Flags for VXattr */
|
||||
static const unsigned VXATTR_RSTAT = 0x1;
|
||||
static const unsigned VXATTR_DIRSTAT = 0x2;
|
||||
|
||||
static const VXattr _dir_vxattrs[];
|
||||
static const VXattr _file_vxattrs[];
|
||||
|
Loading…
Reference in New Issue
Block a user