From: Sage Weil Date: Sun, 25 May 2008 20:44:39 +0000 (-0700) Subject: mds: set_updated on scatterlocks X-Git-Tag: v0.3~170^2~67 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3eb47ba5a94fb7d615dbc3f425e64bb8815a2d73;p=ceph.git mds: set_updated on scatterlocks --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index b7f7e1a4bfde..7f8faa9d924b 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -1223,12 +1223,12 @@ void Locker::revoke_client_leases(SimpleLock *lock) void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, CInode *in, CDir *parent, - bool do_nested, bool do_parent, int linkunlink) + bool primary_dn, bool do_parent, int linkunlink) { dout(10) << "predirty_nested " << (do_parent ? "do_parent_mtime ":"") << "linkunlink=" << linkunlink - << (do_nested ? "do_nested ":"") + << (primary_dn ? "primary_dn ":"remote_dn ") << " " << *in << dendl; if (!parent) @@ -1254,17 +1254,6 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, //assert(mut->wrlocks.count(&pin->nestedlock)); } - if (do_nested && - mut->wrlocks.count(&pin->dirlock) == 0 && - !scatter_wrlock_try(&pin->dirlock, mut)) { - dout(10) << "predirty_nested can't wrlock " << pin->dirlock << " on " << *pin << dendl; - do_nested = false; - break; - } - - if (!do_parent && !do_nested) - break; - // inode -> dirfrag mut->add_projected_fnode(parent); @@ -1281,7 +1270,7 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, pf->fraginfo.nfiles += linkunlink; } } - if (do_nested) { + if (primary_dn) { if (linkunlink == 0) { drbytes = curi->nested.rbytes - curi->accounted_nested.rbytes; drfiles = curi->nested.rfiles - curi->accounted_nested.rfiles; @@ -1312,12 +1301,25 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, pf->nested.rfiles += linkunlink; } + + // stop? if (pin->is_base()) break; - if (!pin->is_auth()) { - if (do_parent) - mut->ls->dirty_dirfrag_dir.push_back(&pin->xlist_dirty_dirfrag_dir); - mut->ls->dirty_dirfrag_nested.push_back(&pin->xlist_dirty_dirfrag_nested); + + bool stop = false; + if (mut->wrlocks.count(&pin->dirlock) == 0 && + !scatter_wrlock_try(&pin->dirlock, mut)) { + dout(10) << "predirty_nested can't wrlock " << pin->dirlock << " on " << *pin << dendl; + stop = true; + } + if (!pin->is_auth() || pin->is_ambiguous_auth()) { + dout(10) << "predirty_nested !auth or ambig on " << *pin << dendl; + stop = true; + } + if (stop) { + dout(10) << "predirty_nested stop. marking dirty dirfrag/scatterlock on " << *pin << dendl; + mut->add_updated_scatterlock(&pin->dirlock); + mut->ls->dirty_dirfrag_nested.push_back(&pin->xlist_dirty_dirfrag_dir); break; } @@ -1355,6 +1357,7 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, parent = cur->get_projected_parent_dn()->get_dir(); linkunlink = 0; do_parent = false; + primary_dn = true; } // now, stick it in the blob diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index b797e1b1715f..0049a1f3a7dd 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -103,6 +103,7 @@ struct Mutation { // for applying projected inode changes list projected_inodes; list projected_fnodes; + list updated_scatterlocks; Mutation() : ls(0), done_locking(false), committing(false), aborted(false) {} @@ -171,10 +172,18 @@ struct Mutation { dir->pop_and_dirty_projected_fnode(ls); } } + + void add_updated_scatterlock(ScatterLock *lock) { + updated_scatterlocks.push_back(lock); + } void apply() { pop_and_dirty_projected_inodes(); pop_and_dirty_projected_fnodes(); + for (list::iterator p = updated_scatterlocks.begin(); + p != updated_scatterlocks.end(); + p++) + (*p)->set_updated(); } virtual void print(ostream &out) {