From: Yan, Zheng Date: Tue, 16 Sep 2014 06:40:13 +0000 (+0800) Subject: client: request xattrs if xattr_version is 0 X-Git-Tag: v0.88~174^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2503%2Fhead;p=ceph.git 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 --- 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();