]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: ensure that rdlock on snap filelock flushes data
authorSage Weil <sage@newdream.net>
Thu, 5 Aug 2010 21:09:53 +0000 (14:09 -0700)
committerSage Weil <sage@newdream.net>
Thu, 5 Aug 2010 21:09:53 +0000 (14:09 -0700)
Do the head filelock sync 'anonymously', so that we can_rdlock(-1) (no
particular client) and thus can't rdlock in the EXCL state.

src/mds/Locker.cc
src/mds/Locker.h

index e0849f278077b4ccc7fa6492c41633346403ca9a..494cd23504617b6365cd7db75d43d628bcfbd38b 100644 (file)
@@ -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!
index f10fcf75b14c50d4d6c308c3fd89cc24ca5dac2d..248f018814e7fbd2727a20deab0956a8893f869d 100644 (file)
@@ -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);