aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-01-18 13:31:09 -0500
committerAlex Elder <elder@inktank.com>2013-01-25 18:33:37 -0500
commitc04306471ad93f1daf60771a0373316d4c3494ae (patch)
tree2d5bbe316ab638fb2ca983b981bd15e2776e987f /drivers/block
parent38901e0f240b634467fb31743365af80a006be33 (diff)
rbd: don't retry setting up header watch
When an rbd image is initially mapped a watch event is registered so we can do something if the header object changes. The code that does this currently loops if initiating the watch request results in an ERANGE error. The osds will never return ERANGE, so there's no reason to do this loop, so get rid of it. This resolves: http://tracker.newdream.net/issues/3860 Note that the problem this loop was intended to solve is a race between collecting image header information and setting up the watch on the header object. The real fix for that problem is described here: http://tracker.newdream.net/issues/3871 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 58d01e3a0fce..668936381ab0 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1474,6 +1474,9 @@ static int rbd_req_sync_watch(struct rbd_device *rbd_dev, int start)
1474 struct ceph_osd_req_op *op; 1474 struct ceph_osd_req_op *op;
1475 int ret = 0; 1475 int ret = 0;
1476 1476
1477 rbd_assert(start ^ !!rbd_dev->watch_event);
1478 rbd_assert(start ^ !!rbd_dev->watch_request);
1479
1477 if (start) { 1480 if (start) {
1478 struct ceph_osd_client *osdc; 1481 struct ceph_osd_client *osdc;
1479 1482
@@ -1482,8 +1485,6 @@ static int rbd_req_sync_watch(struct rbd_device *rbd_dev, int start)
1482 &rbd_dev->watch_event); 1485 &rbd_dev->watch_event);
1483 if (ret < 0) 1486 if (ret < 0)
1484 return ret; 1487 return ret;
1485 } else {
1486 rbd_assert(rbd_dev->watch_request != NULL);
1487 } 1488 }
1488 1489
1489 op = rbd_osd_req_op_create(CEPH_OSD_OP_WATCH, 1490 op = rbd_osd_req_op_create(CEPH_OSD_OP_WATCH,
@@ -3023,22 +3024,6 @@ static void rbd_bus_del_dev(struct rbd_device *rbd_dev)
3023 device_unregister(&rbd_dev->dev); 3024 device_unregister(&rbd_dev->dev);
3024} 3025}
3025 3026
3026static int rbd_init_watch_dev(struct rbd_device *rbd_dev)
3027{
3028 int ret, rc;
3029
3030 do {
3031 ret = rbd_req_sync_watch(rbd_dev, 1);
3032 if (ret == -ERANGE) {
3033 rc = rbd_dev_refresh(rbd_dev, NULL);
3034 if (rc < 0)
3035 return rc;
3036 }
3037 } while (ret == -ERANGE);
3038
3039 return ret;
3040}
3041
3042static atomic64_t rbd_dev_id_max = ATOMIC64_INIT(0); 3027static atomic64_t rbd_dev_id_max = ATOMIC64_INIT(0);
3043 3028
3044/* 3029/*
@@ -3584,7 +3569,7 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev)
3584 if (ret) 3569 if (ret)
3585 goto err_out_bus; 3570 goto err_out_bus;
3586 3571
3587 ret = rbd_init_watch_dev(rbd_dev); 3572 ret = rbd_req_sync_watch(rbd_dev, 1);
3588 if (ret) 3573 if (ret)
3589 goto err_out_bus; 3574 goto err_out_bus;
3590 3575