]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: reorder timing checks in request_inode_file_caps
authorGreg Farnum <gregory.farnum@dreamhost.com>
Fri, 22 Jul 2011 18:45:03 +0000 (11:45 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Fri, 22 Jul 2011 18:45:03 +0000 (11:45 -0700)
We do want to hold onto caps for a few seconds after the client
closes it, just in case it decides to re-open again! With the
old arrangement the keep time was never moved off of zero.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/mds/Locker.cc

index b53370fb3d6899ee3de39587bb0de5f5181086bd..b72d58e984e0a48ca4ffb3734474e7dfd23b1720 100644 (file)
@@ -1727,25 +1727,25 @@ void Locker::request_inode_file_caps(CInode *in)
   if (wanted != in->replica_caps_wanted) {
 
     if (wanted == 0) {
-      if (in->replica_caps_wanted_keep_until < ceph_clock_now(g_ceph_context)) {
-        // ok, release them finally!
-        in->replica_caps_wanted_keep_until.sec_ref() = 0;
-        dout(7) << "request_inode_file_caps " << ccap_string(wanted)
-                 << " was " << ccap_string(in->replica_caps_wanted) 
-                 << " no keeping anymore " 
-                 << " on " << *in 
-                 << dendl;
-      }
-      else if (in->replica_caps_wanted_keep_until.sec() == 0) {
+      if (in->replica_caps_wanted_keep_until.sec() == 0) {
         in->replica_caps_wanted_keep_until = ceph_clock_now(g_ceph_context);
         in->replica_caps_wanted_keep_until.sec_ref() += 2;
         
         dout(7) << "request_inode_file_caps " << ccap_string(wanted)
-                 << " was " << ccap_string(in->replica_caps_wanted) 
-                 << " keeping until " << in->replica_caps_wanted_keep_until
-                 << " on " << *in 
-                 << dendl;
+                           << " was " << ccap_string(in->replica_caps_wanted)
+                           << " keeping until " << in->replica_caps_wanted_keep_until
+                           << " on " << *in
+                           << dendl;
         return;
+      } else if (in->replica_caps_wanted_keep_until <
+          ceph_clock_now(g_ceph_context)) {
+        // ok, release them finally!
+        in->replica_caps_wanted_keep_until.sec_ref() = 0;
+        dout(7) << "request_inode_file_caps " << ccap_string(wanted)
+                     << " was " << ccap_string(in->replica_caps_wanted)
+                     << " no keeping anymore "
+                     << " on " << *in
+                     << dendl;
       } else {
         // wait longer
         return;