From: Chaitanya Kulkarni <kch@nvidia.com>
To: <linux-nvme@lists.infradead.org>
Cc: <kbusch@kernel.org>, <hch@lst.de>, <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH] nvme-core: decode the error on add disk()
Date: Thu, 16 Jan 2025 12:15:27 -0800 [thread overview]
Message-ID: <20250116201527.9252-1-kch@nvidia.com> (raw)
While debugging the problem, it is important to know that what exact
error returned by device_add_disk() along side the disk name. Print
the error along with disk name when device_add_disk() fails when
allocating the namespace.
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/nvme/host/core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 2a0555856795..0be42f9b86b5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3868,6 +3868,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
struct nvme_ns *ns;
struct gendisk *disk;
int node = ctrl->numa_node;
+ int rc;
ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node);
if (!ns)
@@ -3933,8 +3934,12 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
synchronize_srcu(&ctrl->srcu);
nvme_get_ctrl(ctrl);
- if (device_add_disk(ctrl->device, ns->disk, nvme_ns_attr_groups))
+ rc = device_add_disk(ctrl->device, ns->disk, nvme_ns_attr_groups);
+ if (rc) {
+ dev_err(ctrl->device, "%s:failed to add disk %d:%s\n",
+ __func__, rc, disk->disk_name);
goto out_cleanup_ns_from_list;
+ }
if (!nvme_ns_head_multipath(ns->head))
nvme_add_ns_cdev(ns);
--
2.40.0
next reply other threads:[~2025-01-16 20:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 20:15 Chaitanya Kulkarni [this message]
2025-01-17 8:31 ` [PATCH] nvme-core: decode the error on add disk() Christoph Hellwig
2025-01-20 16:57 ` Ewan Milne
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=20250116201527.9252-1-kch@nvidia.com \
--to=kch@nvidia.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox