[PATCH] nvme_fc: replace ioabort msleep loop with completion

James Smart jsmart2021 at gmail.com
Sat May 13 07:24:30 PDT 2017


On 5/10/2017 10:22 AM, Christoph Hellwig wrote:

>> -	while (ctrl->iocnt) {
>> +	if (ctrl->iocnt) {
>> +		init_completion(&ctrl->ioaborts_done);
>>  		spin_unlock_irqrestore(&ctrl->lock, flags);
>> -		msleep(1000);
>> +
>> +		wait_for_completion(&ctrl->ioaborts_done);
>> +
>>  		spin_lock_irqsave(&ctrl->lock, flags);
>> +		WARN_ON(ctrl->iocnt);
>
> But more importantly the single wait is potentially wrong.  Please
> switch to a waitqueue and use wait_event_lock_irq here.
>

Why do you think a single wait is wrong ?

All aborts have been scheduled, which is what ctrl->iocnt tracks, and 
will not increase. Thus ctrl->iocnt is set to its max prior to init'ing 
the completion and releasing the lock. The completion only triggers on 
decrement of ctrl->iocnt to zero checked under lock.

-- james



More information about the Linux-nvme mailing list