Skip to content

Commit

Permalink
librbd: don't cancel request lock early
Browse files Browse the repository at this point in the history
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 d9dd5c5)
  • Loading branch information
Jason Dillaman committed Jul 29, 2015
1 parent 58ae92f commit 92272dd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/librbd/ImageWatcher.cc
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 92272dd

Please sign in to comment.