Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373519
b: refs/heads/master
c: 0d8189e
h: refs/heads/master
i:
  373517: c4f4137
  373515: 86c1088
  373511: 1af0731
  373503: 74e2e03
v: v3
  • Loading branch information
Alex Elder authored and Sage Weil committed May 2, 2013
1 parent b1f94f6 commit bdf2b26
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 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: 332bb12db9459d52dfcdb278e7607351d2eff6ab
refs/heads/master: 0d8189e175380c029a309f05f44e82bacf1c0404
31 changes: 23 additions & 8 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4729,6 +4729,7 @@ static int rbd_dev_probe_parent(struct rbd_device *rbd_dev)
static int rbd_dev_probe_finish(struct rbd_device *rbd_dev)
{
int ret;
int tmp;

ret = rbd_dev_header_watch_sync(rbd_dev, 1);
if (ret)
Expand Down Expand Up @@ -4780,6 +4781,9 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev)
unregister_blkdev(rbd_dev->major, rbd_dev->name);
err_out_id:
rbd_dev_id_put(rbd_dev);
tmp = rbd_dev_header_watch_sync(rbd_dev, 0);
if (tmp)
rbd_warn(rbd_dev, "failed to cancel watch event (%d)\n", ret);
rbd_dev_mapping_clear(rbd_dev);

return ret;
Expand Down Expand Up @@ -4975,9 +4979,6 @@ static void rbd_dev_release(struct device *dev)
{
struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);

if (rbd_dev->watch_event)
rbd_dev_header_watch_sync(rbd_dev, 0);

/* clean up and free blkdev */
rbd_free_disk(rbd_dev);
unregister_blkdev(rbd_dev->major, rbd_dev->name);
Expand All @@ -5003,6 +5004,7 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev)
struct rbd_device *first = rbd_dev;
struct rbd_device *second = first->parent;
struct rbd_device *third;
int ret;

/*
* Follow to the parent with no grandparent and
Expand All @@ -5013,6 +5015,10 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev)
second = third;
}
rbd_assert(second);
ret = rbd_dev_header_watch_sync(rbd_dev, 0);
if (ret)
rbd_warn(rbd_dev,
"failed to cancel watch event (%d)\n", ret);
rbd_remove_all_snaps(second);
rbd_bus_del_dev(second);
first->parent = NULL;
Expand All @@ -5029,13 +5035,13 @@ static ssize_t rbd_remove(struct bus_type *bus,
size_t count)
{
struct rbd_device *rbd_dev = NULL;
int target_id, rc;
int target_id;
unsigned long ul;
int ret = count;
int ret;

rc = strict_strtoul(buf, 10, &ul);
if (rc)
return rc;
ret = strict_strtoul(buf, 10, &ul);
if (ret)
return ret;

/* convert to int; abort if we lost anything in the conversion */
target_id = (int) ul;
Expand All @@ -5059,6 +5065,15 @@ static ssize_t rbd_remove(struct bus_type *bus,
if (ret < 0)
goto done;

ret = rbd_dev_header_watch_sync(rbd_dev, 0);
if (ret) {
rbd_warn(rbd_dev, "failed to cancel watch event (%d)\n", ret);
clear_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags);
smp_mb();
return ret;
}
ret = count;

rbd_dev_remove_parent(rbd_dev);

rbd_remove_all_snaps(rbd_dev);
Expand Down

0 comments on commit bdf2b26

Please sign in to comment.