diff options
author | Josh Durgin <josh.durgin@inktank.com> | 2013-08-29 20:36:03 -0400 |
---|---|---|
committer | Josh Durgin <josh.durgin@inktank.com> | 2013-09-09 14:16:02 -0400 |
commit | 20e0af67ce88c657d0601977b9941a2256afbdaa (patch) | |
tree | 850fb98180ca9a41b600fe444b7d615146c5b1ed | |
parent | 9abc59908e0c5f983aaa91150da32d5b62cf60b7 (diff) |
rbd: make rbd_obj_notify_ack() synchronous
The only user of rbd_obj_notify_ack() is rbd_watch_cb(). It used
asynchronously with no tracking of when the notify ack completes, so
it may still be in progress when the osd_client is shut down. This
results in a BUG() since the osd client assumes no requests are in
flight when it stops. Since all notifies are flushed before the
osd_client is stopped, waiting for the notify ack to complete before
returning from the watch callback ensures there are no notify acks in
flight during shutdown.
Rename rbd_obj_notify_ack() to rbd_obj_notify_ack_sync() to reflect
its new synchronous nature.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
-rw-r--r-- | drivers/block/rbd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index bf89e348d11b..9e5f07f936dd 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -2808,7 +2808,7 @@ out_err: | |||
2808 | obj_request_done_set(obj_request); | 2808 | obj_request_done_set(obj_request); |
2809 | } | 2809 | } |
2810 | 2810 | ||
2811 | static int rbd_obj_notify_ack(struct rbd_device *rbd_dev, u64 notify_id) | 2811 | static int rbd_obj_notify_ack_sync(struct rbd_device *rbd_dev, u64 notify_id) |
2812 | { | 2812 | { |
2813 | struct rbd_obj_request *obj_request; | 2813 | struct rbd_obj_request *obj_request; |
2814 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; | 2814 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; |
@@ -2823,16 +2823,17 @@ static int rbd_obj_notify_ack(struct rbd_device *rbd_dev, u64 notify_id) | |||
2823 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request); | 2823 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request); |
2824 | if (!obj_request->osd_req) | 2824 | if (!obj_request->osd_req) |
2825 | goto out; | 2825 | goto out; |
2826 | obj_request->callback = rbd_obj_request_put; | ||
2827 | 2826 | ||
2828 | osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_NOTIFY_ACK, | 2827 | osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_NOTIFY_ACK, |
2829 | notify_id, 0, 0); | 2828 | notify_id, 0, 0); |
2830 | rbd_osd_req_format_read(obj_request); | 2829 | rbd_osd_req_format_read(obj_request); |
2831 | 2830 | ||
2832 | ret = rbd_obj_request_submit(osdc, obj_request); | 2831 | ret = rbd_obj_request_submit(osdc, obj_request); |
2833 | out: | ||
2834 | if (ret) | 2832 | if (ret) |
2835 | rbd_obj_request_put(obj_request); | 2833 | goto out; |
2834 | ret = rbd_obj_request_wait(obj_request); | ||
2835 | out: | ||
2836 | rbd_obj_request_put(obj_request); | ||
2836 | 2837 | ||
2837 | return ret; | 2838 | return ret; |
2838 | } | 2839 | } |
@@ -2852,7 +2853,7 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) | |||
2852 | if (ret) | 2853 | if (ret) |
2853 | rbd_warn(rbd_dev, "header refresh error (%d)\n", ret); | 2854 | rbd_warn(rbd_dev, "header refresh error (%d)\n", ret); |
2854 | 2855 | ||
2855 | rbd_obj_notify_ack(rbd_dev, notify_id); | 2856 | rbd_obj_notify_ack_sync(rbd_dev, notify_id); |
2856 | } | 2857 | } |
2857 | 2858 | ||
2858 | /* | 2859 | /* |