From: Sage Weil Date: Tue, 3 Jun 2008 16:04:03 +0000 (-0700) Subject: mds: half-finished scatter timeouts X-Git-Tag: v0.3~170^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c0355a27dab276f855b8f7e6301a4cf15772be8;p=ceph.git mds: half-finished scatter timeouts --- diff --git a/src/TODO b/src/TODO index cda0fcbb0c2..b18cdabd05a 100644 --- a/src/TODO +++ b/src/TODO @@ -65,8 +65,6 @@ mon - osdmon needs to lower-bound old osdmap versions it keeps around? mds mustfix -- fix rejoin vs updated dirfrag nested/dirlocks - - not inode_full, now.. send the fnode. but for auth dirfrags, _to_ inode auth... which is sorta outside the subtree..? /- locks (esp scatter) vs rejoin, scatter_writebehind - make sure locker avoids frozen inodes diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 9913fecae0f..5b9f6269216 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -1222,6 +1222,20 @@ void Locker::revoke_client_leases(SimpleLock *lock) // nested --------------------------------------------------------------- +void Locker::mark_updated_scatterlock(ScatterLock *lock) +{ + lock->set_updated(); + if (lock->xlistitem_updated.get_xlist()) { + dout(10) << "mark_updated_scatterlock " << *lock + << " -- already on list since " << lock->update_stamp << dendl; + } else { + updated_scatterlocks.push_back(&lock->xlistitem_updated); + lock->update_stamp = g_clock.now(); + dout(10) << "mark_updated_scatterlock " << *lock + << " -- added at " << lock->update_stamp << dendl; + } +} + /* * NOTE: we _have_ to delay the scatter if we are called during a * rejoin, because we can't twiddle locks between when the @@ -1357,7 +1371,7 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, } if (stop) { dout(10) << "predirty_nested stop. marking dirlock on " << *pin << dendl; - pin->dirlock.set_updated(); + mark_updated_scatterlock(&pin->dirlock); mut->add_updated_scatterlock(&pin->dirlock); mut->ls->dirty_dirfrag_dir.push_back(&pin->xlist_dirty_dirfrag_dir); break; @@ -2766,6 +2780,28 @@ void Locker::scatter_unscatter_autoscattered() } if (--n == 0) break; } + + + // updated + while (!updated_scatterlocks.empty()) { + ScatterLock *lock = updated_scatterlocks.front(); + + if (!lock->is_updated() || + !lock->get_parent()->is_auth() || + !lock->is_stable()) { + updated_scatterlocks.pop_front(); + dout(10) << " removed from updated_scatterlocks " << *lock << " " << *lock->get_parent() << dendl; + continue; + } + + if (now - lock->update_stamp < 10.0) + break; + + updated_scatterlocks.pop_front(); + + dout(10) << " scattering updated_scatterlocks item " << *lock << " " << *lock->get_parent() << dendl; + scatter_scatter(lock); + } } diff --git a/src/mds/Locker.h b/src/mds/Locker.h index 48d46959530..34266c87edf 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -164,7 +164,9 @@ protected: }; void scatter_writebehind_finish(ScatterLock *lock, Mutation *mut); + xlist updated_scatterlocks; public: + void mark_updated_scatterlock(ScatterLock *lock); void predirty_nested(Mutation *mut, EMetaBlob *blob, CInode *in, CDir *dir, int flags, int linkunlink=0); diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h index 84416dcf2b3..4c8ad48e7e1 100644 --- a/src/mds/ScatterLock.h +++ b/src/mds/ScatterLock.h @@ -69,12 +69,15 @@ class ScatterLock : public SimpleLock { public: xlist::item xlistitem_autoscattered; + xlist::item xlistitem_updated; + utime_t update_stamp; ScatterLock(MDSCacheObject *o, int t, int wo) : SimpleLock(o, t, wo), num_wrlock(0), updated(false), - xlistitem_autoscattered(this) {} + xlistitem_autoscattered(this), + xlistitem_updated(this) {} int get_replica_state() { switch (state) { diff --git a/src/mds/events/ECommitted.h b/src/mds/events/ECommitted.h new file mode 100644 index 00000000000..eb5a5aebc18 --- /dev/null +++ b/src/mds/events/ECommitted.h @@ -0,0 +1,44 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2004-2006 Sage Weil + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef __MDS_ECOMMITTED_H +#define __MDS_ECOMMITTED_H + +#include "../LogEvent.h" +#include "EMetaBlob.h" + +class ECommitted : public LogEvent { +public: + metareqid_t reqid; + + ECommitted() : LogEvent(EVENT_COMMITTED) { } + ECommitted(metareqid_t r) : + LogEvent(EVENT_COMMITTED), reqid(r) { } + + void print(ostream& out) { + out << "ECommitted " << reqid; + } + + void encode(bufferlist &bl) const { + ::encode(reqid, bl); + } + void decode(bufferlist::iterator &bl) { + ::decode(reqid, bl); + } + + void update_segment() {} + void replay(MDS *mds); +}; + +#endif