[PATCH] nvme-pci: Skip queue deletion if there are no queues

Alex G. mr.nuke.me at gmail.com
Wed Mar 28 14:02:01 PDT 2018


On 03/28/2018 03:22 PM, Keith Busch wrote:
> On Wed, Mar 28, 2018 at 03:13:37PM -0500, Alex G. wrote:
>> Which branch am I supposed to be using to test this? It doesn't apply to
>> mainline.
> 
> This is targeted to the 4.17 staging trees (sorry, this doesn't seem to
> be a good 4.16 candidate this late in the game). This should apply on
> linux-block for-4.17/block here:
> 
>   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/log/?h=for-4.17/block

Then I should probably test with that.
Tested-by: Alex Gagniuc <Alex_Gagniuc at Dellteam.com>

So I see the check is really meant to protect dereferencing
&dev->queues[0] in nvme_disable_admin_queue(). My previous comment is
still valid then. Successfully tested this approach as well.

Thanks for the quick turn-around.

Alex

> 
> A 4.16 port would would like this:
> 
> ---
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index b6f43b738f03..2459067d208b 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2194,7 +2194,7 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
>  	 * Give the controller a chance to complete all entered requests if
>  	 * doing a safe shutdown.
>  	 */
> -	if (!dead) {
> +	if (!dead && dev->ctrl.queue_count > 0) {
>  		if (shutdown)
>  			nvme_wait_freeze_timeout(&dev->ctrl, NVME_IO_TIMEOUT);
>  
> --
> 



More information about the Linux-nvme mailing list