]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: avoid adding checked inode to the delayed_caps
authordongdong tao <tdd21151186@gmail.com>
Wed, 27 Dec 2017 06:27:57 +0000 (14:27 +0800)
committerdongdong tao <tdd21151186@gmail.com>
Thu, 4 Jan 2018 04:35:03 +0000 (12:35 +0800)
no need to check again in delayed_caps

Signed-off-by: dongdong tao <tdd21151186@gmail.com>
src/client/Client.cc

index 1c2d66002eab9cae54558fdf7aaff549c9239576..2d4a09ffa4a9ba21c3147c4e72c6edd62918c73e 100644 (file)
@@ -3200,7 +3200,7 @@ int Client::get_caps_used(Inode *in)
 
 void Client::cap_delay_requeue(Inode *in)
 {
-  ldout(cct, 10) << "cap_delay_requeue on " << *in << dendl;
+  ldout(cct, 10) << __func__ << " on " << *in << dendl;
   in->hold_caps_until = ceph_clock_now();
   in->hold_caps_until += cct->_conf->client_caps_release_delay;
   delayed_caps.push_back(&in->cap_item);
@@ -3389,13 +3389,6 @@ void Client::check_caps(Inode *in, unsigned flags)
   if (!in->cap_snaps.empty())
     flush_snaps(in);
 
-  if (flags & CHECK_CAPS_NODELAY)
-    in->hold_caps_until = utime_t();
-  else
-    cap_delay_requeue(in);
-
-  utime_t now = ceph_clock_now();
-
   for (auto &it : in->caps) {
     mds_rank_t mds = it.first;
     Cap &cap = it.second;
@@ -3445,8 +3438,9 @@ void Client::check_caps(Inode *in, unsigned flags)
        !in->dirty_caps)                 // and we have no dirty caps
       continue;
 
-    if (now < in->hold_caps_until) {
+    if (!(flags & CHECK_CAPS_NODELAY)) {
       ldout(cct, 10) << "delaying cap release" << dendl;
+      cap_delay_requeue(in);
       continue;
     }