]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: clear EXPORTINGCAPS on export_reverse
authorSage Weil <sage@newdream.net>
Tue, 7 Dec 2010 15:58:01 +0000 (07:58 -0800)
committerSage Weil <sage@newdream.net>
Wed, 8 Dec 2010 00:44:18 +0000 (16:44 -0800)
We need to reverse the effects of encode_export_inode_caps(), which is just
the pin and state bit.

The original problem can be reproduced with
 - ceph tell mds 0 injectargs '--mds-kill-import-at 5'
 - restart mds
 - recovery completes successfully
 - wait for the subtree to be reexported
 - fail with bad EXPORTINGCAPS get in encode_export_inode_caps

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/CInode.h
src/mds/Migrator.cc

index c6f7ad9d1969d1b9abc66917b5e5ff32d737bb20..ab3613c27adfc1d725de9b64a71ef327e97d97ab 100644 (file)
@@ -652,6 +652,9 @@ private:
   void finish_export(utime_t now);
   void abort_export() {
     put(PIN_TEMPEXPORTING);
+    assert(state_test(STATE_EXPORTINGCAPS));
+    state_clear(STATE_EXPORTINGCAPS);
+    put(PIN_EXPORTINGCAPS);
   }
   void decode_import(bufferlist::iterator& p, LogSegment *ls);
   
index aa1b88f7a087ea006d2a9425d877fab2deb3d217..046eff573322cd31992d09c4e2607caf7a38948e 100644 (file)
@@ -920,6 +920,8 @@ void Migrator::encode_export_inode(CInode *in, bufferlist& enc_state,
 void Migrator::encode_export_inode_caps(CInode *in, bufferlist& bl, 
                                        map<client_t,entity_inst_t>& exported_client_map)
 {
+  dout(20) << "encode_export_inode_caps " << *in << dendl;
+
   // encode caps
   map<client_t,Capability::Export> cap_map;
   in->export_client_caps(cap_map);
@@ -937,6 +939,8 @@ void Migrator::encode_export_inode_caps(CInode *in, bufferlist& bl,
 
 void Migrator::finish_export_inode_caps(CInode *in)
 {
+  dout(20) << "finish_export_inode_caps " << *in << dendl;
+
   in->state_clear(CInode::STATE_EXPORTINGCAPS);
   in->put(CInode::PIN_EXPORTINGCAPS);
 
@@ -1225,7 +1229,8 @@ void Migrator::export_reverse(CDir *dir)
     dir->abort_export();
     for (CDir::map_t::iterator p = dir->items.begin(); p != dir->items.end(); ++p) {
       p->second->abort_export();
-      if (!p->second->get_linkage()->is_primary()) continue;
+      if (!p->second->get_linkage()->is_primary())
+       continue;
       CInode *in = p->second->get_linkage()->get_inode();
       in->abort_export();
       if (in->is_dir())
@@ -1895,6 +1900,7 @@ void Migrator::import_reverse(CDir *dir)
        p != import_caps[dir].end();
        ++p) {
     CInode *in = p->first;
+    dout(20) << " reexporting caps on " << *in << dendl;
     /*
      * bleh.. just export all caps for this inode.  the auth mds
      * will pick them up during recovery.