[PATCH] nvme: block ioctls if controller not in a live state

James Smart jsmart2021 at gmail.com
Wed May 9 16:20:19 PDT 2018


On 5/8/2018 12:15 AM, Johannes Thumshirn wrote:
> On Mon, May 07, 2018 at 03:55:58PM -0700, James Smart wrote:
>> Rather than allow ioctl-based admin cmds to get intermixed on the admin
>> queue with commands being used to initialize a controller or io commands
>> to go to a controller in reconnect thus possibly hanging, reject them
>> if the controller isn't in the LIVE state. Reject with an -EAGAIN status
>> so that the app knows it could retry.
> 
> Shouldn't the nvmf_check_if_read() calls in the transport drivers'
> ->queue_rq() callouts handle this?
> 


yes - but if things reach that layer, the return status for the ioctl 
can be quite different.  (if I read things right) The core routines are 
coded so that if there's a hard error, a -Exxx status will be returned. 
Otherwise, it returns the nvme_req(req)->status value (assumed positive 
big value). Which means, if the if_ready checks reject it, it'll go back 
with an NVME_SC_ABORT_REQ status. Which means the cli gets a convoluted 
error response. For the cases where it would be blocked by controller 
state, I want an -EAGAIN status so that the app knows it can retry and 
it should succeed sometime in the future.  Any other status - the app 
gives up and accepts the status value.

-- james



More information about the Linux-nvme mailing list