]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: switch to use projected inode instead 47058/head
authorXiubo Li <xiubli@redhat.com>
Mon, 13 Jun 2022 09:28:00 +0000 (17:28 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 12 Jul 2022 04:41:11 +0000 (12:41 +0800)
When the client send a sync request to MDS even the client has the
Xx caps, for example, the MDS will revoke the Xx caps back and journal
new changes.

If the client try to create a sub-directory the MDS was always using
the non-projected inode of parent to inherit the gid/uid/mode metadatas,
if the journal log still haven't been flushed and applied yet, it will
always get the old metadatas.

Fixes: https://tracker.ceph.com/issues/56010
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 9e0b3518cbe60d9686eb309135f7eb0383b7bb98)

src/mds/Server.cc

index b6e4e960b756fc793c00d286a444701acba70ed8..de9c4722cafd3561687ae9a9e49ccf7f46db3e74 100644 (file)
@@ -3352,18 +3352,20 @@ CInode* Server::prepare_new_inode(MDRequestRef& mdr, CDir *dir, inodeno_t useino
   _inode->truncate_seq = 1; /* starting with 1, 0 is kept for no-truncation logic */
 
   CInode *diri = dir->get_inode();
+  auto pip = diri->get_projected_inode();
 
-  dout(10) << oct << " dir mode 0" << diri->get_inode()->mode << " new mode 0" << mode << dec << dendl;
+  dout(10) << oct << " dir mode 0" << pip->mode << " new mode 0" << mode << dec << dendl;
 
-  if (diri->get_inode()->mode & S_ISGID) {
+  if (pip->mode & S_ISGID) {
     dout(10) << " dir is sticky" << dendl;
-    _inode->gid = diri->get_inode()->gid;
+    _inode->gid = pip->gid;
     if (S_ISDIR(mode)) {
-      dout(10) << " new dir also sticky" << dendl;      
+      dout(10) << " new dir also sticky" << dendl;
       _inode->mode |= S_ISGID;
     }
-  } else 
+  } else {
     _inode->gid = mdr->client_request->get_caller_gid();
+  }
 
   _inode->uid = mdr->client_request->get_caller_uid();