aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-10-30 20:40:33 -0400
committerAlex Elder <elder@inktank.com>2012-11-01 08:55:42 -0400
commita92ffdf8a9b09f8fae9a8f418f87f30a5e459570 (patch)
tree61afe269696ac3ce6f999f67f6cc9385a0bd637c /drivers
parent2c0d0a10ea89456781218f458f6bf72e99d87d2a (diff)
rbd: allow null image name
Format 2 parent images are partially identified by their image id, but it may not be possible to determine their image name. The name is not strictly needed for correct operation, so we won't be treating it as an error if we don't know it. Handle this case gracefully in rbd_name_show(). Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/rbd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index a8521338bf46..28052ff679ca 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1982,7 +1982,10 @@ static ssize_t rbd_name_show(struct device *dev,
1982{ 1982{
1983 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); 1983 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
1984 1984
1985 return sprintf(buf, "%s\n", rbd_dev->spec->image_name); 1985 if (rbd_dev->spec->image_name)
1986 return sprintf(buf, "%s\n", rbd_dev->spec->image_name);
1987
1988 return sprintf(buf, "(unknown)\n");
1986} 1989}
1987 1990
1988static ssize_t rbd_image_id_show(struct device *dev, 1991static ssize_t rbd_image_id_show(struct device *dev,