summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2013-08-30 04:16:42 +0200
committerJosh Durgin <josh.durgin@inktank.com>2013-09-09 20:16:32 +0200
commitefadc98aab674153709cc357ba565f04e3164fcd (patch)
tree4cdf435882f6bb95be440b5a0f439a28ea9f544e
parentrbd: fix use-after free of rbd_dev->disk (diff)
downloadlinux-efadc98aab674153709cc357ba565f04e3164fcd.tar.xz
linux-efadc98aab674153709cc357ba565f04e3164fcd.zip
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>
-rw-r--r--drivers/block/rbd.c9
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)
snap_id = snapc->snaps[which];
snap_name = rbd_dev_v2_snap_name(rbd_dev, snap_id);
- if (IS_ERR(snap_name))
- break;
+ if (IS_ERR(snap_name)) {
+ /* ignore no-longer existing snapshots */
+ if (PTR_ERR(snap_name) == -ENOENT)
+ continue;
+ else
+ break;
+ }
found = !strcmp(name, snap_name);
kfree(snap_name);
}