Skip to content

Commit

Permalink
Merge pull request ceph#7220 from dillaman/wip-13810-jewel
Browse files Browse the repository at this point in the history
tests: notification slave needs to wait for master

Reviewed-by: Josh Durgin <[email protected]>
  • Loading branch information
jdurgin committed Jan 14, 2016
2 parents 0108b9a + 3992d6f commit 2697b30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/librbd/AioImageRequestWQ.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,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;
}

Expand All @@ -78,6 +79,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;
}

Expand Down
4 changes: 3 additions & 1 deletion src/test/librbd/test_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 2697b30

Please sign in to comment.