From 92272dd676ebb67a3095ce3933cac24809b054da Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Fri, 15 May 2015 11:18:29 -0400 Subject: [PATCH] librbd: don't cancel request lock early 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 (cherry picked from commit d9dd5c5890029107df40ed438f23fb9865d7de29) --- src/librbd/ImageWatcher.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index 4da24b7ac3cf0..71b4c863d0b2f 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -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) { -- 2.39.5