* [PATCH] nvme-core: decode the error on add disk()
@ 2025-01-16 20:15 Chaitanya Kulkarni
2025-01-17 8:31 ` Christoph Hellwig
2025-01-20 16:57 ` Ewan Milne
0 siblings, 2 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2025-01-16 20:15 UTC (permalink / raw)
To: linux-nvme; +Cc: kbusch, hch, sagi, Chaitanya Kulkarni
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-core: decode the error on add disk()
2025-01-16 20:15 [PATCH] nvme-core: decode the error on add disk() Chaitanya Kulkarni
@ 2025-01-17 8:31 ` Christoph Hellwig
2025-01-20 16:57 ` Ewan Milne
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2025-01-17 8:31 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-nvme, kbusch, hch, sagi
On Thu, Jan 16, 2025 at 12:15:27PM -0800, Chaitanya Kulkarni wrote:
> 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.
Sounds like this would be better places in device_add_disk and not
in the drivers.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-core: decode the error on add disk()
2025-01-16 20:15 [PATCH] nvme-core: decode the error on add disk() Chaitanya Kulkarni
2025-01-17 8:31 ` Christoph Hellwig
@ 2025-01-20 16:57 ` Ewan Milne
1 sibling, 0 replies; 3+ messages in thread
From: Ewan Milne @ 2025-01-20 16:57 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-nvme, kbusch, hch, sagi
On Thu, Jan 16, 2025 at 3:19 PM Chaitanya Kulkarni <kch@nvidia.com> wrote:
>
> 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.
This is fine as far as it goes. Looking at the code around namespace scanning
there appear to be several other places where an error is silently handled and
the namespace won't show up. e.g. if nvme_get_effects_log() -> nvme_get_log()
fails in nvme_alloc_ns_head(). That is beyond the intent of this one
patch though.
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-20 16:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16 20:15 [PATCH] nvme-core: decode the error on add disk() Chaitanya Kulkarni
2025-01-17 8:31 ` Christoph Hellwig
2025-01-20 16:57 ` Ewan Milne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox