]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: don't cancel request lock early 4695/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 15 May 2015 15:18:29 +0000 (11:18 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 5 Jun 2015 16:33:44 +0000 (12:33 -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>
src/librbd/ImageWatcher.cc

index 78cbd28d88f0f3f8a2edfaaee09cdd0a65222227..e0e73c3bff0d1bf1d0535ac2bb070246f97d0556 100644 (file)
@@ -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) {