diff options
author | Josh Durgin <josh.durgin@inktank.com> | 2013-08-29 22:16:42 -0400 |
---|---|---|
committer | Josh Durgin <josh.durgin@inktank.com> | 2013-09-09 14:16:32 -0400 |
commit | efadc98aab674153709cc357ba565f04e3164fcd (patch) | |
tree | 4cdf435882f6bb95be440b5a0f439a28ea9f544e /drivers/block | |
parent | 9875201e10496612080e7d164acc8f625c18725c (diff) |
rbd: ignore unmapped snapshots that no longer exist
This prevents erroring out while adding a device when a snapshot
unrelated to the current mapping is deleted between reading the
snapshot context and reading the snapshot names. If the mapped
snapshot name is not found an error still occurs as usual.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 47c6f9cf9dba..626a7136fb2f 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -4078,8 +4078,13 @@ static u64 rbd_v2_snap_id_by_name(struct rbd_device *rbd_dev, const char *name) | |||
4078 | 4078 | ||
4079 | snap_id = snapc->snaps[which]; | 4079 | snap_id = snapc->snaps[which]; |
4080 | snap_name = rbd_dev_v2_snap_name(rbd_dev, snap_id); | 4080 | snap_name = rbd_dev_v2_snap_name(rbd_dev, snap_id); |
4081 | if (IS_ERR(snap_name)) | 4081 | if (IS_ERR(snap_name)) { |
4082 | break; | 4082 | /* ignore no-longer existing snapshots */ |
4083 | if (PTR_ERR(snap_name) == -ENOENT) | ||
4084 | continue; | ||
4085 | else | ||
4086 | break; | ||
4087 | } | ||
4083 | found = !strcmp(name, snap_name); | 4088 | found = !strcmp(name, snap_name); |
4084 | kfree(snap_name); | 4089 | kfree(snap_name); |
4085 | } | 4090 | } |