From: John Spray Date: Tue, 2 Jun 2015 09:17:29 +0000 (+0100) Subject: mds: refactor BADFRAG setting X-Git-Tag: v9.0.3~132^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=16f7add341b61453b96c1a290d71df88f92f1428;p=ceph.git mds: refactor BADFRAG setting So that the procedure around setting STATE_BADFRAG on a CDir can be used from other forthcoming error handling. Signed-off-by: John Spray --- diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index f8970a27ff9..36daf33e12d 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -1738,14 +1738,7 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map& 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& 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 diff --git a/src/mds/CDir.h b/src/mds/CDir.h index d415721431a..be0f10aa6b9 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -506,6 +506,12 @@ protected: const std::set *snaps, bool *force_dirty, list *undef_inodes); + + /** + * Mark this fragment as BADFRAG + */ + void go_bad(); + void _omap_fetched(bufferlist& hdrbl, std::map& omap, const std::string& want_dn, int r); void _tmap_fetch(const std::string& want_dn);