]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
SQUASH: client: querying for stx_version field requires getting all shared caps
authorJeff Layton <jlayton@redhat.com>
Thu, 1 Sep 2016 22:49:46 +0000 (18:49 -0400)
committerJeff Layton <jlayton@redhat.com>
Thu, 1 Sep 2016 22:49:46 +0000 (18:49 -0400)
Otherwise, someone could potentially query for just CEPH_STATX_VERSION,
and see it as unchanged, even when there are changes buffered up on
other clients.

By doing this, I don't think we'll incur any perf hit in the common use
case which is ganesha querying for all attributes. We are adding Xs
here, but unless there is a lot of xattr activity I don't think that
will generally cause a lot of exclusive cap recalls.

Also, we don't actually need AUTH caps to fetch CEPH_STATX_RDEV, remove
that from statx_to_mask. PIN is sufficient there.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/client/Client.cc

index c664dcd636bfcc9cb0d432b290a6f8adbc84a253..39e6760f5c28ede73365cc1d69d089c3aa7d3766 100644 (file)
@@ -6724,13 +6724,14 @@ unsigned Client::statx_to_mask(unsigned int flags, unsigned int want)
 
   /* Always set PIN to distinguish from AT_NO_ATTR_SYNC case */
   mask |= CEPH_CAP_PIN;
-  if (want & (CEPH_STATX_MODE|CEPH_STATX_UID|CEPH_STATX_GID|CEPH_STATX_RDEV|CEPH_STATX_BTIME))
+  if (want & (CEPH_STATX_MODE|CEPH_STATX_UID|CEPH_STATX_GID|CEPH_STATX_BTIME|CEPH_STATX_VERSION))
     mask |= CEPH_CAP_AUTH_SHARED;
-  if (want & CEPH_STATX_NLINK)
+  if (want & CEPH_STATX_NLINK|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))
     mask |= CEPH_CAP_FILE_SHARED;
-
+  if (want & CEPH_STATX_VERSION)
+    mask |= CEPH_CAP_XATTR_SHARED;
 out:
   return mask;
 }