]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: drop x/wrlocks before, rdlocks after sending reply
authorSage Weil <sage@newdream.net>
Tue, 17 Aug 2010 19:16:02 +0000 (12:16 -0700)
committerSage Weil <sage@newdream.net>
Fri, 17 Sep 2010 18:26:57 +0000 (11:26 -0700)
This lets us issue the most leases/caps possible.  It also ensure we can
issue caps in the snapped namespace when we are still on the head inode
(previously, releasing the rdlock twiddled the state, the client didn't
get say Frc, and hung indefinitely).

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

index 6bdab93eac37ba8c8b12a4ffd14526012193deed..cf2da38955551d6539a2e8126a2bf1079d761833 100644 (file)
@@ -388,6 +388,14 @@ void Locker::drop_locks(Mutation *mut)
     wrlock_finish(*mut->wrlocks.begin(), mut);
 }
 
+void Locker::drop_non_rdlocks(Mutation *mut)
+{
+  while (!mut->xlocks.empty()) 
+    xlock_finish(*mut->xlocks.begin(), mut);
+  while (!mut->wrlocks.empty()) 
+    wrlock_finish(*mut->wrlocks.begin(), mut);
+}
+
 void Locker::drop_rdlocks(Mutation *mut)
 {
   while (!mut->rdlocks.empty()) 
index 31ae5ff3e97e89761b53341eee44d621a5ba9578..1a72f773862ee6053d2c4ae41401b29987094819 100644 (file)
@@ -87,6 +87,7 @@ public:
 
   void drop_locks(Mutation *mut);
   void set_xlocks_done(Mutation *mut);
+  void drop_non_rdlocks(Mutation *mut);
   void drop_rdlocks(Mutation *mut);
 
   void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0);
index c3105ff826cded443f64308624688ad2ac1b5cbd..cbe673ce08ee138d8b2cbe13bf3e18f39f08235d 100644 (file)
@@ -855,11 +855,8 @@ void Server::reply_request(MDRequest *mdr, MClientReply *reply, CInode *tracei,
   Connection *client_con = req->get_connection();
   client_con->get();
 
-  // clean up request, drop locks, etc.
-  // do this before replying, so that we can issue leases
-  mdcache->request_finish(mdr);
-  mdr = 0;
-  req = 0;
+  // drop non-rdlocks before replying, so that we can issue leases
+  mds->locker->drop_non_rdlocks(mdr);
 
   // reply at all?
   if (client_inst.name.is_mds()) {
@@ -883,6 +880,11 @@ void Server::reply_request(MDRequest *mdr, MClientReply *reply, CInode *tracei,
   }
   client_con->put();
   
+  // clean up request
+  mdcache->request_finish(mdr);
+  mdr = 0;
+  req = 0;
+
   // take a closer look at tracei, if it happens to be a remote link
   if (tracei && 
       tracei->get_parent_dn() &&