[PATCHv2] NVMe: Fix removal in case of active namespace list scanning method

Keith Busch keith.busch at intel.com
Fri May 27 06:28:36 PDT 2016


On Fri, May 27, 2016 at 03:59:43PM +0530, Sunad Bhandary S wrote:
>  static int nvme_scan_ns_list(struct nvme_ctrl *ctrl, unsigned nn)
>  {
>  	struct nvme_ns *ns;
> @@ -1497,7 +1508,7 @@ static int nvme_scan_ns_list(struct nvme_ctrl *ctrl, unsigned nn)
>  	for (i = 0; i < num_lists; i++) {
>  		ret = nvme_identify_ns_list(ctrl, prev, ns_list);
>  		if (ret)
> -			goto out;
> +			goto free;
>  
>  		for (j = 0; j < min(nn, 1024U); j++) {
>  			nsid = le32_to_cpu(ns_list[j]);
> @@ -1515,13 +1526,14 @@ static int nvme_scan_ns_list(struct nvme_ctrl *ctrl, unsigned nn)
>  		nn -= j;
>  	}
>   out:
> +	nvme_remove_invalid_namespaces(ctrl, prev);
> + free:

We don't want to remove the namespaces on error here. That could remove
valid, in use namespaces: if nvme_identify_ns_list fails (maybe controller
just doesn't support that identify mode), we do the sequential scanning.

Just leave the 'goto free' alone, and call nvme_remove_invalid_namespaces
only on success.



More information about the Linux-nvme mailing list