[PATCH 1/2] nvmet: fix oops in nvmet_execute_passthru_cmd()

Logan Gunthorpe logang at deltatee.com
Thu Aug 6 15:55:17 EDT 2020



On 2020-08-06 1:54 p.m., Sagi Grimberg wrote:
> 
>>> This adds an extra label. Also I don't understand why we should change
>>> the order of nvmet_req_complete() and blk_put_request() in
>>> nvmet_passthru_execute_cmd() and make is inconsistent with in
>>> nvmet_passthru_req_done() ?
>>
>> I don't know why an extra label is an issue and I don't think the
>> inconsistency is important. This follows the common pattern where things
>> are cleaned up in the reverse order of their creation and labels are
>> used to control which cleanups happen based on how far it got:
>>
>> rc = setup1();
>> if (rc)
>>       return -1;
>>
>> rc = setup2();
>> if (rc)
>>     goto out_teardown1;
>>
>>
>> rc = setup3();
>> if (rc)
>>     goto teardown2;
>>
>> return;
>>
>> out_teradown2:
>>      teardown2();
>> out_teardown1:
>>      teardown1();
>>      return -1;
>>
> 
> Can we also add a label to remove the if (ns) condition?

No, because the ns is only conditionally allocated if the queue-id is
non-zero.



More information about the Linux-nvme mailing list