Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359644
b: refs/heads/master
c: 8eb8756
h: refs/heads/master
v: v3
  • Loading branch information
Alex Elder authored and Sage Weil committed Feb 14, 2013
1 parent 170d34d commit 434c73c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 25dcf954c3230946b5f3e18db9f91d7640eff76e
refs/heads/master: 8eb87565306cf40a32f5d0883d008675cd2dd510
30 changes: 21 additions & 9 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,7 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start)
&rbd_dev->watch_event);
if (ret < 0)
return ret;
rbd_assert(rbd_dev->watch_event != NULL);
}

ret = -ENOMEM;
Expand All @@ -1726,32 +1727,43 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start)
if (!obj_request->osd_req)
goto out_cancel;

if (start) {
if (start)
ceph_osdc_set_request_linger(osdc, obj_request->osd_req);
rbd_dev->watch_request = obj_request;
} else {
else
ceph_osdc_unregister_linger_request(osdc,
rbd_dev->watch_request->osd_req);
rbd_dev->watch_request = NULL;
}
ret = rbd_obj_request_submit(osdc, obj_request);
if (ret)
goto out_cancel;
ret = rbd_obj_request_wait(obj_request);
if (ret)
goto out_cancel;

ret = obj_request->result;
if (ret)
goto out_cancel;

if (start)
goto done; /* Done if setting up the watch request */
/*
* A watch request is set to linger, so the underlying osd
* request won't go away until we unregister it. We retain
* a pointer to the object request during that time (in
* rbd_dev->watch_request), so we'll keep a reference to
* it. We'll drop that reference (below) after we've
* unregistered it.
*/
if (start) {
rbd_dev->watch_request = obj_request;

return 0;
}

/* We have successfully torn down the watch request */

rbd_obj_request_put(rbd_dev->watch_request);
rbd_dev->watch_request = NULL;
out_cancel:
/* Cancel the event if we're tearing down, or on error */
ceph_osdc_cancel_event(rbd_dev->watch_event);
rbd_dev->watch_event = NULL;
done:
if (obj_request)
rbd_obj_request_put(obj_request);

Expand Down

0 comments on commit 434c73c

Please sign in to comment.