From 67dfaebc6a2d48ab379a28013568822d24cbf35b Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 13 Jan 2016 12:42:05 -0500 Subject: [PATCH 1/2] librbd: log write/discard errors from clip operation Signed-off-by: Jason Dillaman --- src/librbd/AioImageRequestWQ.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librbd/AioImageRequestWQ.cc b/src/librbd/AioImageRequestWQ.cc index 9871bb0535ef4..1132781905511 100644 --- a/src/librbd/AioImageRequestWQ.cc +++ b/src/librbd/AioImageRequestWQ.cc @@ -54,6 +54,7 @@ ssize_t AioImageRequestWQ::write(uint64_t off, uint64_t len, const char *buf, int r = clip_io(&m_image_ctx, off, &len); m_image_ctx.snap_lock.put_read(); if (r < 0) { + lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl; return r; } @@ -77,6 +78,7 @@ int AioImageRequestWQ::discard(uint64_t off, uint64_t len) { int r = clip_io(&m_image_ctx, off, &len); m_image_ctx.snap_lock.put_read(); if (r < 0) { + lderr(cct) << "invalid IO request: " << cpp_strerror(r) << dendl; return r; } From 3992d6fe67bbf82322cedc1582406caaf6d4de60 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 13 Jan 2016 12:44:01 -0500 Subject: [PATCH 2/2] tests: notification slave needs to wait for master If the slave instance starts before the master, race conditions are possible. Fixes: #13810 Backport: infernalis, hammer Signed-off-by: Jason Dillaman --- src/test/librbd/test_notify.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/librbd/test_notify.py b/src/test/librbd/test_notify.py index 4d3a7713fa588..d6f9c537e2920 100755 --- a/src/test/librbd/test_notify.py +++ b/src/test/librbd/test_notify.py @@ -66,6 +66,7 @@ def master(ioctx): while offset < IMG_SIZE: image.write(data, offset) offset += (1 << IMG_ORDER) + image.write('1', IMG_SIZE - 1) assert(image.is_exclusive_lock_owner()) print("waiting for slave to complete") @@ -82,7 +83,8 @@ def slave(ioctx): while True: try: with Image(ioctx, CLONE_IMG_NAME) as image: - if image.list_lockers() != []: + if (image.list_lockers() != [] and + image.read(IMG_SIZE - 1, 1) == '1'): break except Exception: pass