]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: don't re-send interrupted flock request 16248/head
authorYan, Zheng <zyan@redhat.com>
Sat, 3 Jun 2017 04:33:36 +0000 (12:33 +0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 10 Jul 2017 20:58:21 +0000 (13:58 -0700)
don't re-send interrupted flock request in cases of mds failover
and receiving request forward.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 044fabd669fdc8287f5cab0f38a82dfbfe41f0cd)

 Conflicts:
src/client/Client.cc: UserPerms not in jewel

src/client/Client.cc

index d66fdc757a4d96fee559e56c29f6449aa73d95d0..611181b49888dbd16528be22aa60b2d8cbb08c9d 100644 (file)
@@ -2704,11 +2704,19 @@ void Client::kick_requests(MetaSession *session)
   for (map<ceph_tid_t, MetaRequest*>::iterator p = mds_requests.begin();
        p != mds_requests.end();
        ++p) {
-    if (p->second->got_unsafe)
+    MetaRequest *req = p->second;
+    if (req->got_unsafe)
+      continue;
+    if (req->aborted()) {
+      if (req->caller_cond) {
+       req->kick = true;
+       req->caller_cond->Signal();
+      }
       continue;
-    if (p->second->retry_attempt > 0)
+    }
+    if (req->retry_attempt > 0)
       continue; // new requests only
-    if (p->second->mds == session->mds_num) {
+    if (req->mds == session->mds_num) {
       send_request(p->second, session);
     }
   }
@@ -2729,6 +2737,8 @@ void Client::resend_unsafe_requests(MetaSession *session)
     MetaRequest *req = p->second;
     if (req->got_unsafe)
       continue;
+    if (req->aborted())
+      continue;
     if (req->retry_attempt == 0)
       continue; // old requests only
     if (req->mds == session->mds_num)
@@ -9026,11 +9036,13 @@ int Client::_do_filelock(Inode *in, Fh *fh, int lock_type, int op, int sleep,
   if (sleep && switch_interrupt_cb) {
     // enable interrupt
     switch_interrupt_cb(callback_handle, req->get());
-
     ret = make_request(req, -1, -1, NULL, NULL, -1, &bl);
-
     // disable interrupt
     switch_interrupt_cb(callback_handle, NULL);
+    if (ret == 0 && req->aborted()) {
+      // effect of this lock request has been revoked by the 'lock intr' request
+      ret = req->get_abort_code();
+    }
     put_request(req);
   } else {
     ret = make_request(req, -1, -1, NULL, NULL, -1, &bl);
@@ -9089,6 +9101,12 @@ int Client::_do_filelock(Inode *in, Fh *fh, int lock_type, int op, int sleep,
 
 int Client::_interrupt_filelock(MetaRequest *req)
 {
+  // Set abort code, but do not kick. The abort code prevents the request
+  // from being re-sent.
+  req->abort(-EINTR);
+  if (req->mds < 0)
+    return 0; // haven't sent the request
+
   Inode *in = req->inode();
 
   int lock_type;