]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: return xattrs when client explictly requests xattrs
authorYan, Zheng <zyan@redhat.com>
Tue, 16 Sep 2014 06:33:41 +0000 (14:33 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 17 Sep 2014 01:38:27 +0000 (09:38 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/CInode.cc

index 8624b66896eef795a25069fa312d6be2823c0ebb..98de66e4cd830816ca82719cf9e9bb9a9086f486 100644 (file)
@@ -2952,13 +2952,12 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session,
   
   // xattr
   i = pxattr ? pi:oi;
-  bool had_latest_xattrs = cap && (cap->issued() & CEPH_CAP_XATTR_SHARED) &&
-    cap->client_xattr_version == i->xattr_version &&
-    snapid == CEPH_NOSNAP;
 
   // xattr
   bufferlist xbl;
-  if (!had_latest_xattrs) {
+  if ((!cap && !no_caps) ||
+      (cap && cap->client_xattr_version < i->xattr_version) ||
+      (getattr_caps & CEPH_CAP_XATTR_SHARED)) { // client requests xattrs
     if (!pxattrs)
       pxattrs = pxattr ? get_projected_xattrs() : &xattrs;
     ::encode(*pxattrs, xbl);