]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Referent hardlink Recovery - Store remote_inode
authorKotresh HR <khiremat@redhat.com>
Thu, 27 Feb 2025 17:42:07 +0000 (23:12 +0530)
committerKotresh HR <khiremat@redhat.com>
Tue, 4 Mar 2025 06:20:47 +0000 (11:50 +0530)
Store the remote_inode/real inode as an xattr
on the referent inode in the data pool.

Fixes: https://tracker.ceph.com/issues/69338
Signed-off-by: Kotresh HR <khiremat@redhat.com>
src/mds/CInode.cc
src/mds/CInode.h

index e45219d87f2b6c40e2002846f0e97a1bf108ed34..7bddb58b48fe13a823e427eced8802126cf9518f 100644 (file)
@@ -78,6 +78,12 @@ void CInodeCommitOperation::update(ObjectOperation &op, inode_backtrace_t &bt) {
     encode(_symlink, symlink_bl);
     op.setxattr("symlink", symlink_bl);
   }
+
+  if (remote_inode) {
+    bufferlist remote_inode_bl;
+    encode(remote_inode, remote_inode_bl);
+    op.setxattr("remote_inode", remote_inode_bl);
+  }
 }
 
 class CInodeIOContext : public MDSIOContextBase
@@ -1410,8 +1416,12 @@ void CInode::_store_backtrace(std::vector<CInodeCommitOperation> &ops_vec,
     slink = symlink;
   }
 
+  inodeno_t remote_inode = 0;
+  if (is_referent_remote())
+    remote_inode = get_remote_ino();
+
   ops_vec.emplace_back(op_prio, pool, get_inode()->layout,
-                       mdcache->mds->mdsmap->get_up_features(), slink);
+                       mdcache->mds->mdsmap->get_up_features(), slink, remote_inode);
 
   if (!state_test(STATE_DIRTYPOOL) || get_inode()->old_pools.empty() || ignore_old_pools) {
     dout(20) << __func__ << ": no dirtypool or no old pools or ignore_old_pools" << dendl;
index cd3e440d06bc7bce7598c6175f299d7c84cedef5..29206c2d8c77d981a72f296752615dabf143b3dc 100644 (file)
@@ -66,8 +66,8 @@ public:
   CInodeCommitOperation(int prio, int64_t po)
     : pool(po), priority(prio) {
   }
-  CInodeCommitOperation(int prio, int64_t po, file_layout_t l, uint64_t f, std::string_view s)
-    : pool(po), priority(prio), _layout(l), _features(f), _symlink(s) {
+  CInodeCommitOperation(int prio, int64_t po, file_layout_t l, uint64_t f, std::string_view s, inodeno_t ri)
+    : pool(po), priority(prio), _layout(l), _features(f), _symlink(s), remote_inode(ri) {
       update_layout_symlink = true;
   }
 
@@ -81,6 +81,7 @@ private:
   file_layout_t _layout;
   uint64_t _features;
   std::string_view _symlink;
+  inodeno_t remote_inode;     // real inode of the referent inode
 };
 
 struct CInodeCommitOperations {