From: Sage Weil Date: Thu, 5 Aug 2010 21:09:53 +0000 (-0700) Subject: mds: ensure that rdlock on snap filelock flushes data X-Git-Tag: v0.22~308^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=acfcfa02595a8d4b7620a036a0cb0e550e0a2160;p=ceph.git mds: ensure that rdlock on snap filelock flushes data Do the head filelock sync 'anonymously', so that we can_rdlock(-1) (no particular client) and thus can't rdlock in the EXCL state. --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index e0849f27807..494cd235046 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -749,12 +749,12 @@ bool Locker::rdlock_try(SimpleLock *lock, client_t client, Context *con) return false; } -bool Locker::rdlock_start(SimpleLock *lock, MDRequest *mut) +bool Locker::rdlock_start(SimpleLock *lock, MDRequest *mut, bool as_anon) { dout(7) << "rdlock_start on " << *lock << " on " << *lock->get_parent() << dendl; // client may be allowed to rdlock the same item it has xlocked. - client_t client = mut->get_client(); + client_t client = as_anon ? -1 : mut->get_client(); if (!lock->get_parent()->is_auth() && lock->fw_rdlock_to_auth()) { @@ -784,7 +784,7 @@ bool Locker::rdlock_start(SimpleLock *lock, MDRequest *mut) // okay, we actually need to kick the head's lock to get ourselves synced up. CInode *head = mdcache->get_inode(in->ino()); dout(10) << "rdlock_start trying head inode " << *head << dendl; - return rdlock_start(head->get_lock(lock->get_type()), mut); + return rdlock_start(head->get_lock(lock->get_type()), mut, true); // ** as_anon, no rdlock on EXCL ** } // wait! diff --git a/src/mds/Locker.h b/src/mds/Locker.h index f10fcf75b14..248f018814e 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -105,7 +105,7 @@ public: bool _rdlock_kick(SimpleLock *lock); bool rdlock_try(SimpleLock *lock, client_t client, Context *c); - bool rdlock_start(SimpleLock *lock, MDRequest *mut); + bool rdlock_start(SimpleLock *lock, MDRequest *mut, bool as_anon=false); void rdlock_finish(SimpleLock *lock, Mutation *mut); void wrlock_force(SimpleLock *lock, Mutation *mut);