]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: notify the xattr_version to replica MDSes 46472/head
authorXiubo Li <xiubli@redhat.com>
Wed, 1 Jun 2022 02:32:58 +0000 (10:32 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 16 Jun 2022 13:01:02 +0000 (21:01 +0800)
When one client changes a xattr's value in the auth MDS, when replying
to the client the MDS possibly will drop the increased xattr_version
and new value in the reply message if no 'Xs' caps will be issued to
the client together.

And when the client wants to get this xattr's value, and if it sends
the request to a replicated MDS, since the replicated MDS still has
the old value of the xattr_version, and then the client will drop the
xattr value since xattr_version is not changed.

We need to notify the xattr_version to the replicated MDSes together
with the xattrs when notifying the lock state.

Fixes: https://tracker.ceph.com/issues/55331
Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/mds/CInode.cc

index 4012a4ad4d4ae60c1301d0c5c711f9bab7540cd1..2617880e07b9169fd1fafbd9b6eb807ead7a837c 100644 (file)
@@ -2044,10 +2044,11 @@ void CInode::decode_lock_inest(bufferlist::const_iterator& p)
 
 void CInode::encode_lock_ixattr(bufferlist& bl)
 {
-  ENCODE_START(1, 1, bl);
+  ENCODE_START(2, 1, bl);
   encode(get_inode()->version, bl);
   encode(get_inode()->ctime, bl);
   encode_xattrs(bl);
+  encode(get_inode()->xattr_version, bl);
   ENCODE_FINISH(bl);
 }
 
@@ -2055,13 +2056,16 @@ void CInode::decode_lock_ixattr(bufferlist::const_iterator& p)
 {
   ceph_assert(!is_auth());
   auto _inode = allocate_inode(*get_inode());
-  DECODE_START(1, p);
+  DECODE_START(2, p);
   decode(_inode->version, p);
   utime_t tm;
   decode(tm, p);
   if (_inode->ctime < tm)
     _inode->ctime = tm;
   decode_xattrs(p);
+  if (struct_v >= 2) {
+    decode(_inode->xattr_version, p);
+  }
   DECODE_FINISH(p);
   reset_inode(std::move(_inode));
 }