diff options
-rw-r--r-- | drivers/block/rbd.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 1278098624e..7392d7af7ea 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1253,6 +1253,35 @@ fail: | |||
1253 | return ret; | 1253 | return ret; |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | /* | ||
1257 | * Request sync osd unwatch | ||
1258 | */ | ||
1259 | static int rbd_req_sync_unwatch(struct rbd_device *dev, | ||
1260 | const char *obj) | ||
1261 | { | ||
1262 | struct ceph_osd_req_op *ops; | ||
1263 | |||
1264 | int ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_WATCH, 0); | ||
1265 | if (ret < 0) | ||
1266 | return ret; | ||
1267 | |||
1268 | ops[0].watch.ver = 0; | ||
1269 | ops[0].watch.cookie = cpu_to_le64(dev->watch_event->cookie); | ||
1270 | ops[0].watch.flag = 0; | ||
1271 | |||
1272 | ret = rbd_req_sync_op(dev, NULL, | ||
1273 | CEPH_NOSNAP, | ||
1274 | 0, | ||
1275 | CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, | ||
1276 | ops, | ||
1277 | 1, obj, 0, 0, NULL, NULL, NULL); | ||
1278 | |||
1279 | rbd_destroy_ops(ops); | ||
1280 | ceph_osdc_cancel_event(dev->watch_event); | ||
1281 | dev->watch_event = NULL; | ||
1282 | return ret; | ||
1283 | } | ||
1284 | |||
1256 | struct rbd_notify_info { | 1285 | struct rbd_notify_info { |
1257 | struct rbd_device *dev; | 1286 | struct rbd_device *dev; |
1258 | }; | 1287 | }; |
@@ -2290,7 +2319,7 @@ static void rbd_dev_release(struct device *dev) | |||
2290 | ceph_osdc_unregister_linger_request(&rbd_dev->client->osdc, | 2319 | ceph_osdc_unregister_linger_request(&rbd_dev->client->osdc, |
2291 | rbd_dev->watch_request); | 2320 | rbd_dev->watch_request); |
2292 | if (rbd_dev->watch_event) | 2321 | if (rbd_dev->watch_event) |
2293 | ceph_osdc_cancel_event(rbd_dev->watch_event); | 2322 | rbd_req_sync_unwatch(rbd_dev, rbd_dev->obj_md_name); |
2294 | 2323 | ||
2295 | rbd_put_client(rbd_dev); | 2324 | rbd_put_client(rbd_dev); |
2296 | 2325 | ||