Skip to content

Commit

Permalink
Merge pull request #10051: jewel: Crash when utilizing advisory locki…
Browse files Browse the repository at this point in the history
…ng API functions

Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
Loic Dachary committed Jun 30, 2016
2 parents 57d8c11 + 51defea commit 8107377
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/librbd/ImageCtx.cc
Expand Up @@ -1019,10 +1019,7 @@ struct C_InvalidateCache : public Context {

void ImageCtx::notify_update() {
state->handle_update_notification();

C_SaferCond ctx;
image_watcher->notify_header_update(&ctx);
ctx.wait();
ImageWatcher::notify_header_update(md_ctx, header_oid);
}

void ImageCtx::notify_update(Context *on_finish) {
Expand Down
8 changes: 8 additions & 0 deletions src/librbd/ImageWatcher.cc
Expand Up @@ -317,6 +317,14 @@ void ImageWatcher::notify_header_update(Context *on_finish) {
m_notifier.notify(bl, nullptr, on_finish);
}

void ImageWatcher::notify_header_update(librados::IoCtx &io_ctx,
const std::string &oid) {
// supports legacy (empty buffer) clients
bufferlist bl;
::encode(NotifyMessage(HeaderUpdatePayload()), bl);
io_ctx.notify2(oid, bl, image_watcher::Notifier::NOTIFY_TIMEOUT, nullptr);
}

void ImageWatcher::schedule_cancel_async_requests() {
FunctionContext *ctx = new FunctionContext(
boost::bind(&ImageWatcher::cancel_async_requests, this));
Expand Down
2 changes: 2 additions & 0 deletions src/librbd/ImageWatcher.h
Expand Up @@ -54,6 +54,8 @@ class ImageWatcher {
void notify_request_lock();

void notify_header_update(Context *on_finish);
static void notify_header_update(librados::IoCtx &io_ctx,
const std::string &oid);

uint64_t get_watch_handle() const {
RWLock::RLocker watch_locker(m_watch_lock);
Expand Down

0 comments on commit 8107377

Please sign in to comment.