Skip to content

Commit

Permalink
librbd: avoid calling ImageUpdateWatchers twice
Browse files Browse the repository at this point in the history
Problem:
-------
DisableFeaturesRequest calls send_notify_update, which actually calls
ImageCtx::notify_update, which is currently:

  void ImageCtx::notify_update() {
    state->handle_update_notification();
    ImageWatcher<>::notify_header_update(md_ctx, header_oid);
  }

The state->handle_update_notification() will fire ImageUpdateWatchers
notifications but does not wait for it to complete and then it calls
ImageWatcher<>::notify_header_update, which will send the "header update"
notification for all image watchers, including itself, so it will receive
it itself and will fire ImageUpdateWatchers the second time interfering
with the first call.

Solution:
--------
we don't need state->handle_update_notification() in ImageCtx::notify_update()
as we are going to receive our own notification anyway, here we are just
dropping it.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
  • Loading branch information
Prasanna Kumar Kalever committed Apr 26, 2023
1 parent b8a1c66 commit 32f9ca3
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/librbd/ImageCtx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -956,12 +956,10 @@ librados::IoCtx duplicate_io_ctx(librados::IoCtx& io_ctx) {
}

void ImageCtx::notify_update() {
state->handle_update_notification();
ImageWatcher<>::notify_header_update(md_ctx, header_oid);
}

void ImageCtx::notify_update(Context *on_finish) {
state->handle_update_notification();
image_watcher->notify_header_update(on_finish);
}

Expand Down

0 comments on commit 32f9ca3

Please sign in to comment.