Skip to content

Commit

Permalink
librbd: request exclusive lock when moving to trash
Browse files Browse the repository at this point in the history
Even if the image is in-use, moving it to the trash does not
remove any data. This also solves a race between snapshot-based
mirroring shutting down and being able to move a mirrored image
to the trash.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Mar 20, 2020
1 parent 470ce1c commit ae72633
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librbd/api/Trash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int Trash<I>::move(librados::IoCtx &io_ctx, rbd_trash_image_source_t source,
ictx->exclusive_lock->block_requests(0);

r = ictx->operations->prepare_image_update(
exclusive_lock::OPERATION_REQUEST_TYPE_GENERAL, false);
exclusive_lock::OPERATION_REQUEST_TYPE_GENERAL, true);
if (r < 0) {
lderr(cct) << "cannot obtain exclusive lock - not removing" << dendl;
ictx->owner_lock.unlock_shared();
Expand Down

0 comments on commit ae72633

Please sign in to comment.