From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 4/4] rbd: add warnings to rbd_dev_probe_update_spec()
Date: Thu, 01 Nov 2012 10:27:11 -0500 [thread overview]
Message-ID: <509294CF.8050908@inktank.com> (raw)
In-Reply-To: <50929419.6020302@inktank.com>
Josh suggested adding warnings to this function to help users
diagnose problems.
Other than memory allocatino errors, there are two places where
errors can be returned. Both represent problems that should
have been caught earlier, and as such might well have been
handled with BUG_ON() calls. But if either ever did manage to
happen, it will be reported.
Signed-off-by: Alex Elder <elder@inktank.com>
---
drivers/block/rbd.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 3ab3970..5de49a1 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2646,8 +2646,11 @@ static int rbd_dev_probe_update_spec(struct
rbd_device *rbd_dev)
osdc = &rbd_dev->rbd_client->client->osdc;
name = ceph_pg_pool_name_by_id(osdc->osdmap, rbd_dev->spec->pool_id);
- if (!name)
- return -EIO; /* pool id too large (>= 2^31) */
+ if (!name) {
+ rbd_warn(rbd_dev, "there is no pool with id %llu",
+ rbd_dev->spec->pool_id); /* Really a BUG() */
+ return -EIO;
+ }
rbd_dev->spec->pool_name = kstrdup(name, GFP_KERNEL);
if (!rbd_dev->spec->pool_name)
@@ -2665,6 +2668,8 @@ static int rbd_dev_probe_update_spec(struct
rbd_device *rbd_dev)
name = rbd_snap_name(rbd_dev, rbd_dev->spec->snap_id);
if (!name) {
+ rbd_warn(rbd_dev, "no snapshot with id %llu",
+ rbd_dev->spec->snap_id); /* Really a BUG() */
ret = -EIO;
goto out_err;
}
--
1.7.9.5
prev parent reply other threads:[~2012-11-01 15:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-01 15:24 [PATCH 0/4] rbd: improve warnings Alex Elder
2012-11-01 15:26 ` [PATCH 1/4] rbd: define and use rbd_warn() Alex Elder
2012-11-01 15:26 ` [PATCH 2/4] rbd: add warning messages for missing arguments Alex Elder
2012-11-01 15:26 ` [PATCH 3/4] rbd: add a warning in bio_chain_clone_range() Alex Elder
2012-11-01 15:27 ` Alex Elder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=509294CF.8050908@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.