client: when STATX_NLINK is requested request FsLs caps

We currently determine the getattr request mask prior to doing the
lookup, so we don't necessarily know whether the terminal entry is
a directory or something else.

Directory nlink count is governed by the dirstats, and those are
under Fs caps. Request both Fs and Ls if the request mask includes
STATX_NLINK.

Fixes: https://tracker.ceph.com/issues/48313
Signed-off-by: Jeff Layton <jlayton@redhat.com>
This commit is contained in:
Jeff Layton 2020-11-20 18:43:31 -05:00
parent 3db582b141
commit e2ea2214cb

View File

@ -7612,7 +7612,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;