rbd: unregister linger in watch sync routine
authorAlex Elder <elder@inktank.com>
Fri, 25 Jan 2013 23:08:55 +0000 (17:08 -0600)
committerSage Weil <sage@inktank.com>
Thu, 14 Feb 2013 02:29:09 +0000 (18:29 -0800)
Move the code that unregisters an rbd device's lingering header
object watch request into rbd_dev_header_watch_sync(), so it
occurs in the same function that originally sets up that request.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c

index 4ea89917bb92e404b2c867134e31e6e8f6d1c515..5593def33ce51da0f7bfb79a247cebcdf59d7e72 100644 (file)
@@ -1721,6 +1721,10 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start)
        if (start) {
                rbd_dev->watch_request = obj_request->osd_req;
                ceph_osdc_set_request_linger(osdc, rbd_dev->watch_request);
+       } else {
+               ceph_osdc_unregister_linger_request(osdc,
+                                               rbd_dev->watch_request);
+               rbd_dev->watch_request = NULL;
        }
        ret = rbd_obj_request_submit(osdc, obj_request);
        if (ret)
@@ -3995,12 +3999,6 @@ static void rbd_dev_release(struct device *dev)
 {
        struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
 
-       if (rbd_dev->watch_request) {
-               struct ceph_client *client = rbd_dev->rbd_client->client;
-
-               ceph_osdc_unregister_linger_request(&client->osdc,
-                                                   rbd_dev->watch_request);
-       }
        if (rbd_dev->watch_event)
                rbd_dev_header_watch_sync(rbd_dev, 0);