There is a small window where requests are unblocked and before
the image is shut down where new requests can be accepted. These
are correctly canceled during the shut down, but it can lead to
warning messages.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit
608e09851396a9eeb7cf6dc1c7f687ef7a033601)
// if disabling features w/ exclusive lock supported, we need to
// acquire the lock to temporarily block IO against the image
- if (ictx->exclusive_lock != nullptr && !enabled) {
+ bool acquired_lock = false;
+ if (ictx->exclusive_lock != nullptr &&
+ !ictx->exclusive_lock->is_lock_owner() && !enabled) {
+ acquired_lock = true;
+
C_SaferCond lock_ctx;
ictx->exclusive_lock->request_lock(&lock_ctx);
r = lock_ctx.wait();
}
}
+ if (ictx->exclusive_lock != nullptr && acquired_lock) {
+ C_SaferCond lock_ctx;
+ ictx->exclusive_lock->release_lock(&lock_ctx);
+ r = lock_ctx.wait();
+ if (r < 0) {
+ lderr(cct) << "failed to unlock image: " << cpp_strerror(r) << dendl;
+ return r;
+ }
+ }
+
ictx->notify_update();
return 0;
}