From: Sage Weil Date: Tue, 3 Jun 2008 19:14:03 +0000 (-0700) Subject: mds: lock NUDGE op that is tolerant of ambiguous/migrating auth X-Git-Tag: v0.3~170^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c136fb747464d9ecbe4e8fb85bff0aa14e495b18;p=ceph.git mds: lock NUDGE op that is tolerant of ambiguous/migrating auth --- diff --git a/src/TODO b/src/TODO index c5e59bca86c..a3557e03837 100644 --- a/src/TODO +++ b/src/TODO @@ -71,7 +71,7 @@ mds mustfix /- make sure predirty_nested stops if it can't wrlock versionlock (acquire_locks normally hides that detail for us) - make sure stray inode is always opened on startup /- make sure inode cache expire for frozen inode behaves -- REQSCATTER/REQUNSCATTER ... can we avoid the auth pin requirement? +/- REQUNSCATTER ... can we avoid the auth pin requirement? - look at the client_map session opening code.. versus rollback (of import, or slave request) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 83c8a539345..de3c18e92c7 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2431,16 +2431,15 @@ void Locker::scatter_nudge(ScatterLock *lock, Context *c) << *lock << " on " << *p << dendl; // request unscatter? int auth = lock->get_parent()->authority().first; - if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_ACTIVE) { - if (lock->get_state() == LOCK_SCATTER) - mds->send_message_mds(new MLock(lock, LOCK_AC_REQUNSCATTER, mds->get_nodeid()), auth); - else - mds->send_message_mds(new MLock(lock, LOCK_AC_REQSCATTER, mds->get_nodeid()), auth); - } + if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_ACTIVE) + mds->send_message_mds(new MLock(lock, LOCK_AC_NUDGE, mds->get_nodeid()), auth); // wait... if (c) lock->add_waiter(SimpleLock::WAIT_STABLE, c); + + // also, requeue, in case we had wrong auth or something + updated_scatterlocks.push_back(&lock->xlistitem_updated); } } @@ -2786,6 +2785,7 @@ void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m) } break; + /* case LOCK_AC_REQUNSCATTER: if (!lock->is_stable()) { dout(7) << "handle_scatter_lock ignoring now-unnecessary unscatter request on " << *lock @@ -2797,8 +2797,24 @@ void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m) } else { dout(7) << "handle_scatter_lock DROPPING unscatter request on " << *lock << " on " << *lock->get_parent() << dendl; - /* FIXME: if we can't auth_pin here, this request is effectively lost... */ + // FIXME: if we can't auth_pin here, this request is effectively lost... } + break; + */ + + case LOCK_AC_NUDGE: + if (lock->get_parent()->is_auth()) { + dout(7) << "handle_scatter_lock trying nudge on " << *lock + << " on " << *lock->get_parent() << dendl; + scatter_nudge(lock, 0); + } else { + dout(7) << "handle_scatter_lock IGNORING nudge on non-auth " << *lock + << " on " << *lock->get_parent() << dendl; + } + break; + + default: + assert(0); } delete m; diff --git a/src/messages/MLock.h b/src/messages/MLock.h index 0ae5e6bfdaf..eb2004733f4 100644 --- a/src/messages/MLock.h +++ b/src/messages/MLock.h @@ -33,6 +33,7 @@ #define LOCK_AC_REQSCATTER 7 #define LOCK_AC_REQUNSCATTER 8 +#define LOCK_AC_NUDGE 9 #define LOCK_AC_FOR_REPLICA(a) ((a) < 0) #define LOCK_AC_FOR_AUTH(a) ((a) > 0) @@ -49,6 +50,7 @@ static const char *get_lock_action_name(int a) { case LOCK_AC_LOCKACK: return "lockack"; case LOCK_AC_REQSCATTER: return "reqscatter"; case LOCK_AC_REQUNSCATTER: return "requnscatter"; + case LOCK_AC_NUDGE: return "nudge"; default: assert(0); return 0; } }