]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: handle REQRDLOCK on simple locks too
authorSage Weil <sage@newdream.net>
Mon, 23 Aug 2010 18:16:42 +0000 (11:16 -0700)
committerSage Weil <sage@newdream.net>
Mon, 23 Aug 2010 18:16:42 +0000 (11:16 -0700)
Use a helper.

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

index cf8f38b409912e8d16eb290239e6551ca052ae6a..dd2fe0f1f1d8dd1a9d8bcb83eb36d3aad689eda0 100644 (file)
@@ -2641,6 +2641,22 @@ void Locker::handle_lock(MLock *m)
 // ==========================================================================
 // simple lock
 
+void Locker::handle_reqrdlock(SimpleLock *lock)
+{
+  if (lock->get_parent()->is_auth() &&
+      lock->is_stable() &&
+      lock->get_state() != LOCK_SYNC) {
+    dout(7) << "handle_reqrdlock got rdlock request on " << *lock
+           << " on " << *lock->get_parent() << dendl;
+    assert(lock->get_parent()->is_auth()); // replica auth pinned if they're doing this!
+    simple_sync(lock);
+  } else {
+    dout(7) << "handle_reqrdlock ignoring rdlock request on " << *lock
+           << " on " << *lock->get_parent() << dendl;
+    // replica will retry.
+  }
+}
+
 void Locker::handle_simple_lock(SimpleLock *lock, MLock *m)
 {
   int from = m->get_asker();
@@ -2702,6 +2718,10 @@ void Locker::handle_simple_lock(SimpleLock *lock, MLock *m)
     }
     break;
 
+  case LOCK_AC_REQRDLOCK:
+    handle_reqrdlock(lock);
+    break;
+
   }
 
   m->put();
@@ -3835,18 +3855,7 @@ void Locker::handle_file_lock(ScatterLock *lock, MLock *m)
     break;
 
   case LOCK_AC_REQRDLOCK:
-    if (lock->get_parent()->is_auth() &&
-       lock->is_stable() &&
-       lock->get_state() != LOCK_SYNC) {
-      dout(7) << "handle_file_lock got rdlock request on " << *lock
-             << " on " << *lock->get_parent() << dendl;
-      assert(in->is_auth()); // replica auth pinned if they're doing this!
-      simple_sync(lock);
-    } else {
-      dout(7) << "handle_file_lock ignoring rdlock request on " << *lock
-             << " on " << *lock->get_parent() << dendl;
-      // replica will retry.
-    }
+    handle_reqrdlock(lock);
     break;
 
   case LOCK_AC_NUDGE:
index 0fba2c7fab7f7099a4d70068343594d17898d672..da67cc96eb80ead91b9d731ab695115bc3884275 100644 (file)
@@ -168,6 +168,9 @@ public:
   void mark_updated_scatterlock(ScatterLock *lock);
 
 
+  void handle_reqrdlock(SimpleLock *lock);
+
+
   // caps
   void process_cap_update(MDRequest *mdr, client_t client,
                          inodeno_t ino, uint64_t cap_id, int caps, int wanted,