]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: don't cancel request lock early 5319/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 15 May 2015 15:18:29 +0000 (11:18 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 29 Jul 2015 17:29:54 +0000 (13:29 -0400)
It's possible that a stale notice is received and will
be discarded after the request lock has been canceled.
This will stale the client.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit d9dd5c5890029107df40ed438f23fb9865d7de29)

src/librbd/ImageWatcher.cc

index 4da24b7ac3cf0a5694b024209140ebb7353f1686..71b4c863d0b2f2a9411134a99f5875491dcdf497 100644 (file)
@@ -523,6 +523,7 @@ bool ImageWatcher::decode_lock_cookie(const std::string &tag,
 }
 
 void ImageWatcher::schedule_retry_aio_requests(bool use_timer) {
+  m_task_finisher->cancel(TASK_CODE_REQUEST_LOCK);
   Context *ctx = new FunctionContext(boost::bind(
     &ImageWatcher::retry_aio_requests, this));
   if (use_timer) {
@@ -753,7 +754,6 @@ void ImageWatcher::handle_payload(const AcquiredLockPayload &payload,
                                   bufferlist *out) {
   ldout(m_image_ctx.cct, 10) << this << " image exclusively locked announcement"
                              << dendl;
-  m_task_finisher->cancel(TASK_CODE_REQUEST_LOCK);
   if (payload.client_id.is_valid()) {
     Mutex::Locker l(m_owner_client_id_lock);
     if (payload.client_id == m_owner_client_id) {
@@ -773,7 +773,6 @@ void ImageWatcher::handle_payload(const AcquiredLockPayload &payload,
 void ImageWatcher::handle_payload(const ReleasedLockPayload &payload,
                                   bufferlist *out) {
   ldout(m_image_ctx.cct, 10) << this << " exclusive lock released" << dendl;
-  m_task_finisher->cancel(TASK_CODE_REQUEST_LOCK);
   if (payload.client_id.is_valid()) {
     Mutex::Locker l(m_owner_client_id_lock);
     if (payload.client_id != m_owner_client_id) {