diff mbox

[2/6] rbd: allow null image name

Message ID 5090839A.9060401@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder Oct. 31, 2012, 1:49 a.m. UTC
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>
---
 drivers/block/rbd.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Josh Durgin Oct. 31, 2012, 9:07 p.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 10/30/2012 06:49 PM, Alex Elder wrote:
> 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>
> ---
>   drivers/block/rbd.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index a852133..28052ff 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1982,7 +1982,10 @@ static ssize_t rbd_name_show(struct device *dev,
>   {
>   	struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
>
> -	return sprintf(buf, "%s\n", rbd_dev->spec->image_name);
> +	if (rbd_dev->spec->image_name)
> +		return sprintf(buf, "%s\n", rbd_dev->spec->image_name);
> +
> +	return sprintf(buf, "(unknown)\n");
>   }
>
>   static ssize_t rbd_image_id_show(struct device *dev,
>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index a852133..28052ff 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1982,7 +1982,10 @@  static ssize_t rbd_name_show(struct device *dev,
 {
 	struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);

-	return sprintf(buf, "%s\n", rbd_dev->spec->image_name);
+	if (rbd_dev->spec->image_name)
+		return sprintf(buf, "%s\n", rbd_dev->spec->image_name);
+
+	return sprintf(buf, "(unknown)\n");
 }

 static ssize_t rbd_image_id_show(struct device *dev,