If object map or journaling is dynamically disabled, we want to
ensure that no in-flight IO could be updating the objects while
we attempt to delete them.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
return -EINVAL;
}
+ // 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) {
+ C_SaferCond lock_ctx;
+ ictx->exclusive_lock->request_lock(&lock_ctx);
+ r = lock_ctx.wait();
+ if (r < 0) {
+ lderr(cct) << "failed to lock image: " << cpp_strerror(r) << dendl;
+ return r;
+ } else if (!ictx->exclusive_lock->is_lock_owner()) {
+ lderr(cct) << "failed to acquire exclusive lock" << dendl;
+ return -EROFS;
+ }
+ }
+
RWLock::WLocker snap_locker(ictx->snap_lock);
uint64_t new_features;
if (enabled) {