]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mds/journal.cc
update sources to v12.1.0
[ceph.git] / ceph / src / mds / journal.cc
index a28491547217f0f14e6a0900bf627754096fbf68..5d8088234cd0f6c0d3af0cd96a56606c62ac09a2 100644 (file)
@@ -329,13 +329,20 @@ void EMetaBlob::add_dir_context(CDir *dir, int mode)
 
     if (mode == TO_AUTH_SUBTREE_ROOT) {
       // subtree root?
-      if (dir->is_subtree_root() &&
-         !dir->state_test(CDir::STATE_EXPORTBOUND)) {
-       if (dir->is_auth() && !dir->is_ambiguous_auth() ) {
-         if (dir->state_test(CDir::STATE_AUXSUBTREE) &&
-             dir->get_dir_auth().first == diri->authority().first) {
-           // auxiliary subtree. treat it as normal dirfrag
-           dout(20) << "EMetaBlob::add_dir_context(" << dir << ") auxiliary subtree " << dendl;
+      if (dir->is_subtree_root()) {
+       // match logic in MDCache::create_subtree_map()
+       if (dir->get_dir_auth().first == mds->get_nodeid()) {
+         mds_authority_t parent_auth = parent ? parent->authority() : CDIR_AUTH_UNDEF;
+         if (parent_auth.first == dir->get_dir_auth().first) {
+           if (parent_auth.second == CDIR_AUTH_UNKNOWN &&
+               !dir->is_ambiguous_dir_auth() &&
+               !dir->state_test(CDir::STATE_EXPORTBOUND) &&
+               !dir->state_test(CDir::STATE_AUXSUBTREE) &&
+               !diri->state_test(CInode::STATE_AMBIGUOUSAUTH)) {
+             dout(0) << "EMetaBlob::add_dir_context unexpected subtree " << *dir << dendl;
+             assert(0);
+           }
+           dout(20) << "EMetaBlob::add_dir_context(" << dir << ") ambiguous or transient subtree " << dendl;
          } else {
            // it's an auth subtree, we don't need maybe (if any), and we're done.
            dout(20) << "EMetaBlob::add_dir_context(" << dir << ") reached unambig auth subtree, don't need " << maybe
@@ -351,7 +358,7 @@ void EMetaBlob::add_dir_context(CDir *dir, int mode)
          maybenot = false;
        }
       }
-      
+
       // was the inode journaled in this blob?
       if (event_seq && diri->last_journaled == event_seq) {
        dout(20) << "EMetaBlob::add_dir_context(" << dir << ") already have diri this blob " << *diri << dendl;
@@ -549,6 +556,7 @@ void EMetaBlob::fullbit::update_inode(MDSRank *mds, CInode *in)
 {
   in->inode = inode;
   in->xattrs = xattrs;
+  in->maybe_export_pin();
   if (in->inode.is_dir()) {
     if (!(in->dirfragtree == dirfragtree)) {
       dout(10) << "EMetaBlob::fullbit::update_inode dft " << in->dirfragtree << " -> "
@@ -1305,8 +1313,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
            dout(0) << ss.str() << dendl;
            mds->clog->warn(ss);
          }
-         dir->unlink_inode(dn);
-          mds->mdcache->touch_dentry_bottom(dn);
+         dir->unlink_inode(dn, false);
        }
        if (unlinked.count(in))
          linked.insert(in);
@@ -1318,9 +1325,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
        if (dn->get_linkage()->get_inode() != in && in->get_parent_dn()) {
          dout(10) << "EMetaBlob.replay unlinking " << *in << dendl;
          unlinked[in] = in->get_parent_dir();
-          CDentry *unlinked_dn = in->get_parent_dn();
          in->get_parent_dir()->unlink_inode(in->get_parent_dn());
-          mds->mdcache->touch_dentry_bottom(unlinked_dn);
        }
        if (dn->get_linkage()->get_inode() != in) {
          if (!dn->get_linkage()->is_null()) { // note: might be remote.  as with stray reintegration.
@@ -1332,8 +1337,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
              dout(0) << ss.str() << dendl;
              mds->clog->warn(ss);
            }
-           dir->unlink_inode(dn);
-            mds->mdcache->touch_dentry_bottom(dn);
+           dir->unlink_inode(dn, false);
          }
          if (unlinked.count(in))
            linked.insert(in);
@@ -1378,8 +1382,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
               << " " << *dn->get_linkage()->get_inode() << " should be remote " << p->ino;
            dout(0) << ss.str() << dendl;
          }
-         dir->unlink_inode(dn);
-          mds->mdcache->touch_dentry_bottom(dn);
+         dir->unlink_inode(dn, false);
        }
        dir->link_remote_inode(dn, p->ino, p->d_type);
        dn->set_version(p->dnv);
@@ -1414,7 +1417,6 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
            if (dn->get_linkage()->is_primary())
              unlinked[in] = dir;
            dir->unlink_inode(dn);
-            mds->mdcache->touch_dentry_bottom(dn);
          }
        }
        dn->set_version(p->dnv);
@@ -1428,7 +1430,6 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
 
       // Make null dentries the first things we trim
       dout(10) << "EMetaBlob.replay pushing to bottom of lru " << *dn << dendl;
-      mds->mdcache->touch_dentry_bottom(dn);
     }
   }
 
@@ -1637,7 +1638,6 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
       if (parent) {
         dout(10) << "EMetaBlob.replay unlinked from dentry " << *parent << dendl;
         assert(parent->get_linkage()->is_null());
-        mds->mdcache->touch_dentry_bottom(parent);
       }
     } else {
       dout(10) << "EMetaBlob.replay destroyed " << *p << ", not in cache" << dendl;
@@ -2874,11 +2874,12 @@ void EExport::replay(MDSRank *mds)
 
 void EExport::encode(bufferlist& bl, uint64_t features) const
 {
-  ENCODE_START(3, 3, bl);
+  ENCODE_START(4, 3, bl);
   ::encode(stamp, bl);
   ::encode(metablob, bl, features);
   ::encode(base, bl);
   ::encode(bounds, bl);
+  ::encode(target, bl);
   ENCODE_FINISH(bl);
 }
 
@@ -2890,6 +2891,8 @@ void EExport::decode(bufferlist::iterator &bl)
   ::decode(metablob, bl);
   ::decode(base, bl);
   ::decode(bounds, bl);
+  if (struct_v >= 4)
+    ::decode(target, bl);
   DECODE_FINISH(bl);
 }
 
@@ -2968,13 +2971,14 @@ void EImportStart::replay(MDSRank *mds)
 }
 
 void EImportStart::encode(bufferlist &bl, uint64_t features) const {
-  ENCODE_START(3, 3, bl);
+  ENCODE_START(4, 3, bl);
   ::encode(stamp, bl);
   ::encode(base, bl);
   ::encode(metablob, bl, features);
   ::encode(bounds, bl);
   ::encode(cmapv, bl);
   ::encode(client_map, bl);
+  ::encode(from, bl);
   ENCODE_FINISH(bl);
 }
 
@@ -2987,6 +2991,8 @@ void EImportStart::decode(bufferlist::iterator &bl) {
   ::decode(bounds, bl);
   ::decode(cmapv, bl);
   ::decode(client_map, bl);
+  if (struct_v >= 4)
+    ::decode(from, bl);
   DECODE_FINISH(bl);
 }