From 1f450faaacce3e2a0560efb3db6f88b4ccdd27e5 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Tue, 16 Sep 2014 14:40:13 +0800 Subject: [PATCH] client: request xattrs if xattr_version is 0 Following sequence of events can happen. - Client releases an inode, queues cap release message. - A 'lookup' reply brings the same inode back, but the reply doesn't contain xattrs because MDS didn't receive the cap release message and thought client already has up-to-data xattrs. The fix is force sending a getattr request to MDS if xattrs_version is 0. The getattr mask is set to CEPH_STAT_CAP_XATTR, so MDS knows client does not have xattr. Signed-off-by: Yan, Zheng --- src/client/Client.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 667b700b004e..592336a301a0 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -684,7 +684,7 @@ Inode * Client::add_update_inode(InodeStat *st, utime_t from, in->nlink = st->nlink; } - if ((issued & CEPH_CAP_XATTR_EXCL) == 0 && + if ((in->xattr_version == 0 || !(issued & CEPH_CAP_XATTR_EXCL)) && st->xattrbl.length() && st->xattr_version > in->xattr_version) { bufferlist::iterator p = st->xattrbl.begin(); @@ -7431,7 +7431,7 @@ int Client::_getxattr(Inode *in, const char *name, void *value, size_t size, goto out; } - r = _getattr(in, CEPH_STAT_CAP_XATTR, uid, gid); + r = _getattr(in, CEPH_STAT_CAP_XATTR, uid, gid, in->xattr_version == 0); if (r == 0) { string n(name); r = -ENODATA; @@ -7467,7 +7467,7 @@ int Client::ll_getxattr(Inode *in, const char *name, void *value, int Client::_listxattr(Inode *in, char *name, size_t size, int uid, int gid) { - int r = _getattr(in, CEPH_STAT_CAP_XATTR, uid, gid); + int r = _getattr(in, CEPH_STAT_CAP_XATTR, uid, gid, in->xattr_version == 0); if (r == 0) { for (map::iterator p = in->xattrs.begin(); p != in->xattrs.end(); -- 2.47.3