]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: request xattrs if xattr_version is 0 2503/head
authorYan, Zheng <zyan@redhat.com>
Tue, 16 Sep 2014 06:40:13 +0000 (14:40 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 17 Sep 2014 03:32:17 +0000 (11:32 +0800)
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 <zyan@redhat.com>
src/client/Client.cc

index 667b700b004e61cb5959c8eb949aede54138a878..592336a301a081413d468487a590b28905c87b64 100644 (file)
@@ -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<string,bufferptr>::iterator p = in->xattrs.begin();
         p != in->xattrs.end();