]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: refactor BADFRAG setting
authorJohn Spray <john.spray@redhat.com>
Tue, 2 Jun 2015 09:17:29 +0000 (10:17 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 18 Jun 2015 10:19:44 +0000 (11:19 +0100)
So that the procedure around setting STATE_BADFRAG
on a CDir can be used from other forthcoming error
handling.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/CDir.cc
src/mds/CDir.h

index f8970a27ff9ff636c0edfafcb8d1caea9d5eb2e6..36daf33e12de5351e2abb6f9513aba7698dc143b 100644 (file)
@@ -1738,14 +1738,7 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
     dout(0) << "_fetched missing object for " << *this << dendl;
     clog->error() << "dir " << dirfrag() << " object missing on disk; some files may be lost\n";
 
-    state_set(STATE_BADFRAG);
-    // mark complete, !fetching
-    mark_complete();
-    state_clear(STATE_FETCHING);
-    auth_unpin(this);
-    
-    // kick waiters
-    finish_waiting(WAIT_COMPLETE, 0);
+    go_bad();
     return;
   }
 
@@ -1864,7 +1857,17 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
   finish_waiting(WAIT_COMPLETE, 0);
 }
 
-
+void CDir::go_bad()
+{
+  state_set(STATE_BADFRAG);
+  // mark complete, !fetching
+  mark_complete();
+  state_clear(STATE_FETCHING);
+  auth_unpin(this);
+  
+  // kick waiters
+  finish_waiting(WAIT_COMPLETE, 0);
+}
 
 // -----------------------
 // COMMIT
index d415721431acb679f0a7d47588a9b17cd419a449..be0f10aa6b97919d6dee8c096a8cb8245b8fc1dd 100644 (file)
@@ -506,6 +506,12 @@ protected:
       const std::set<snapid_t> *snaps,
       bool *force_dirty,
       list<CInode*> *undef_inodes);
+
+  /**
+   * Mark this fragment as BADFRAG
+   */
+  void go_bad();
+
   void _omap_fetched(bufferlist& hdrbl, std::map<std::string, bufferlist>& omap,
                     const std::string& want_dn, int r);
   void _tmap_fetch(const std::string& want_dn);