From d9dd5c5890029107df40ed438f23fb9865d7de29 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 --- 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 78cbd28d88f0..e0e73c3bff0d 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -547,6 +547,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) { @@ -802,7 +803,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) { @@ -822,7 +822,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.47.3