Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: hare@suse.de (Hannes Reinecke)
Subject: [PATCH v3 4/7] nvme: make nvme_report_ns_ids propagate error back
Date: Sat, 10 Aug 2019 14:10:18 +0200	[thread overview]
Message-ID: <272ad0ac-ec18-ff11-e691-c28485b2b3aa@suse.de> (raw)
In-Reply-To: <20190808205325.24036-5-sagi@grimberg.me>

On 8/8/19 10:53 PM, Sagi Grimberg wrote:
> And make the callers check the return status and propagate
> back accordingly.
> 
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
>   drivers/nvme/host/core.c | 22 +++++++++++++++++-----
>   1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index e503fd14de81..49ffccd72091 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1603,9 +1603,11 @@ static void nvme_config_write_zeroes(struct gendisk *disk, struct nvme_ns *ns)
>   	blk_queue_max_write_zeroes_sectors(disk->queue, max_sectors);
>   }
>   
> -static void nvme_report_ns_ids(struct nvme_ctrl *ctrl, unsigned int nsid,
> +static int nvme_report_ns_ids(struct nvme_ctrl *ctrl, unsigned int nsid,
>   		struct nvme_id_ns *id, struct nvme_ns_ids *ids)
>   {
> +	int ret = 0;
> +
>   	memset(ids, 0, sizeof(*ids));
>   
>   	if (ctrl->vs >= NVME_VS(1, 1, 0))
> @@ -1616,10 +1618,12 @@ static void nvme_report_ns_ids(struct nvme_ctrl *ctrl, unsigned int nsid,
>   		 /* Don't treat error as fatal we potentially
>   		  * already have a NGUID or EUI-64
>   		  */
> -		if (nvme_identify_ns_descs(ctrl, nsid, ids))
> +		ret = nvme_identify_ns_descs(ctrl, nsid, ids);
> +		if (ret)
>   			dev_warn(ctrl->device,
>   				 "%s: Identify Descriptors failed\n", __func__);
>   	}
> +	return ret;
>   }
>   
>   static bool nvme_ns_ids_valid(struct nvme_ns_ids *ids)
> @@ -1757,7 +1761,10 @@ static int nvme_revalidate_disk(struct gendisk *disk)
>   	}
>   
>   	__nvme_revalidate_disk(disk, id);
> -	nvme_report_ns_ids(ctrl, ns->head->ns_id, id, &ids);
> +	ret = nvme_report_ns_ids(ctrl, ns->head->ns_id, id, &ids);
> +	if (ret)
> +		goto out;
> +
>   	if (!nvme_ns_ids_equal(&ns->head->ids, &ids)) {
>   		dev_err(ctrl->device,
>   			"identifiers changed for nsid %d\n", ns->head->ns_id);
> @@ -3182,7 +3189,9 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
>   	head->ns_id = nsid;
>   	kref_init(&head->ref);
>   
> -	nvme_report_ns_ids(ctrl, nsid, id, &head->ids);
> +	ret = nvme_report_ns_ids(ctrl, nsid, id, &head->ids);
> +	if (ret)
> +		goto out_cleanup_srcu;
>   
>   	ret = __nvme_check_ids(ctrl->subsys, head);
>   	if (ret) {
> @@ -3230,7 +3239,10 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
>   	} else {
>   		struct nvme_ns_ids ids;
>   
> -		nvme_report_ns_ids(ctrl, nsid, id, &ids);
> +		ret = nvme_report_ns_ids(ctrl, nsid, id, &ids);
> +		if (ret)
> +			goto out_unlock;
> +
>   		if (!nvme_ns_ids_equal(&head->ids, &ids)) {
>   			dev_err(ctrl->device,
>   				"IDs don't match for shared namespace %d\n",
> 
Reviewed-by: Hannes Reinecke <hare at suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare at suse.de                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG N?rnberg)

  reply	other threads:[~2019-08-10 12:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 20:53 [PATCH v3 0/7] nvme controller reset and namespace scan work race conditions Sagi Grimberg
2019-08-08 20:53 ` [PATCH v3 1/7] nvme: fail cancelled commands with NVME_SC_HOST_PATH_ERROR Sagi Grimberg
2019-08-10 11:59   ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 2/7] nvme: return nvme_error_status for sync commands failure Sagi Grimberg
2019-08-10 12:06   ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 3/7] nvme: make nvme_identify_ns propagate errors back Sagi Grimberg
2019-08-08 21:18   ` Keith Busch
2019-08-08 23:22     ` Sagi Grimberg
2019-08-10 12:09   ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 4/7] nvme: make nvme_report_ns_ids propagate error back Sagi Grimberg
2019-08-10 12:10   ` Hannes Reinecke [this message]
2019-08-08 20:53 ` [PATCH v3 5/7] nvme-tcp: fail command with NVME_SC_HOST_PATH_ERROR send failed Sagi Grimberg
2019-08-10 12:10   ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 6/7] nvme-fc: Fail transport errors with NVME_SC_HOST_PATH Sagi Grimberg
2019-08-10 12:11   ` Hannes Reinecke
2019-08-08 20:53 ` [PATCH v3 7/7] nvme: don't remove namespace if revalidate failed because of a transport error Sagi Grimberg
2019-08-10 12:14   ` Hannes Reinecke
2019-08-11  5:28     ` Sagi Grimberg
2019-08-08 23:26 ` [PATCH v3 0/7] nvme controller reset and namespace scan work race conditions Bart Van Assche
2019-08-08 23:33   ` Sagi Grimberg
2019-08-08 23:57     ` Bart Van Assche

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=272ad0ac-ec18-ff11-e691-c28485b2b3aa@suse.de \
    --to=hare@suse.de \
    /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