linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen_pvscsi: reclaim the ring request when mapping data failed
@ 2016-07-11  2:51 Bin Wu
  2016-07-11  9:33 ` Juergen Gross
  0 siblings, 1 reply; 5+ messages in thread
From: Bin Wu @ 2016-07-11  2:51 UTC (permalink / raw)
  To: boris.ostrovsky, david.vrabel, jgross, jejb, martin.petersen,
	xen-devel, linux-scsi, linux-kernel, wu.wubin

During scsi command queueing, if mapping data fails, we need to
reclaim the failed request. Otherwise, the garbage request will
be pushed into the ring for the backend to work.

Signed-off-by: Bin Wu <wu.wubin@huawei.com>
---
  drivers/scsi/xen-scsifront.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 9dc8687..655163d 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -565,6 +565,7 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,
      err = map_data_for_request(info, sc, ring_req, shadow);
      if (err < 0) {
          pr_debug("%s: err %d\n", __func__, err);
+        info->ring.req_prod_pvt--;
          scsifront_put_rqid(info, rqid);
          scsifront_return(info);
          spin_unlock_irqrestore(shost->host_lock, flags);
-- 
2.3.2 (Apple Git-55)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xen_pvscsi: reclaim the ring request when mapping data failed
  2016-07-11  2:51 [PATCH] xen_pvscsi: reclaim the ring request when mapping data failed Bin Wu
@ 2016-07-11  9:33 ` Juergen Gross
  2016-07-11  9:50   ` [Xen-devel] " David Vrabel
  0 siblings, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2016-07-11  9:33 UTC (permalink / raw)
  To: Bin Wu, boris.ostrovsky, david.vrabel, jejb, martin.petersen,
	xen-devel, linux-scsi, linux-kernel

On 11/07/16 04:51, Bin Wu wrote:
> During scsi command queueing, if mapping data fails, we need to
> reclaim the failed request. Otherwise, the garbage request will
> be pushed into the ring for the backend to work.

Well spotted. There is another instance of this problem in
scsifront_action_handler(). Would you mind correcting this one, too?


Juergen

> 
> Signed-off-by: Bin Wu <wu.wubin@huawei.com>
> ---
>  drivers/scsi/xen-scsifront.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
> index 9dc8687..655163d 100644
> --- a/drivers/scsi/xen-scsifront.c
> +++ b/drivers/scsi/xen-scsifront.c
> @@ -565,6 +565,7 @@ static int scsifront_queuecommand(struct Scsi_Host
> *shost,
>      err = map_data_for_request(info, sc, ring_req, shadow);
>      if (err < 0) {
>          pr_debug("%s: err %d\n", __func__, err);
> +        info->ring.req_prod_pvt--;
>          scsifront_put_rqid(info, rqid);
>          scsifront_return(info);
>          spin_unlock_irqrestore(shost->host_lock, flags);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH] xen_pvscsi: reclaim the ring request when mapping data failed
  2016-07-11  9:33 ` Juergen Gross
@ 2016-07-11  9:50   ` David Vrabel
  2016-07-11  9:53     ` Juergen Gross
  0 siblings, 1 reply; 5+ messages in thread
From: David Vrabel @ 2016-07-11  9:50 UTC (permalink / raw)
  To: Juergen Gross, Bin Wu, boris.ostrovsky, david.vrabel, jejb,
	martin.petersen, xen-devel, linux-scsi, linux-kernel

On 11/07/16 10:33, Juergen Gross wrote:
> On 11/07/16 04:51, Bin Wu wrote:
>> During scsi command queueing, if mapping data fails, we need to
>> reclaim the failed request. Otherwise, the garbage request will
>> be pushed into the ring for the backend to work.
> 
> Well spotted. There is another instance of this problem in
> scsifront_action_handler(). Would you mind correcting this one, too?

Would it make more sense to advance req_prod_pvt only if the request has
been successfully created?

David

>> Signed-off-by: Bin Wu <wu.wubin@huawei.com>
>> ---
>>  drivers/scsi/xen-scsifront.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
>> index 9dc8687..655163d 100644
>> --- a/drivers/scsi/xen-scsifront.c
>> +++ b/drivers/scsi/xen-scsifront.c
>> @@ -565,6 +565,7 @@ static int scsifront_queuecommand(struct Scsi_Host
>> *shost,
>>      err = map_data_for_request(info, sc, ring_req, shadow);
>>      if (err < 0) {
>>          pr_debug("%s: err %d\n", __func__, err);
>> +        info->ring.req_prod_pvt--;
>>          scsifront_put_rqid(info, rqid);
>>          scsifront_return(info);
>>          spin_unlock_irqrestore(shost->host_lock, flags);
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH] xen_pvscsi: reclaim the ring request when mapping data failed
  2016-07-11  9:50   ` [Xen-devel] " David Vrabel
@ 2016-07-11  9:53     ` Juergen Gross
  2016-07-12  0:29       ` Bin Wu
  0 siblings, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2016-07-11  9:53 UTC (permalink / raw)
  To: David Vrabel, Bin Wu, boris.ostrovsky, jejb, martin.petersen,
	xen-devel, linux-scsi, linux-kernel

On 11/07/16 11:50, David Vrabel wrote:
> On 11/07/16 10:33, Juergen Gross wrote:
>> On 11/07/16 04:51, Bin Wu wrote:
>>> During scsi command queueing, if mapping data fails, we need to
>>> reclaim the failed request. Otherwise, the garbage request will
>>> be pushed into the ring for the backend to work.
>>
>> Well spotted. There is another instance of this problem in
>> scsifront_action_handler(). Would you mind correcting this one, too?
> 
> Would it make more sense to advance req_prod_pvt only if the request has
> been successfully created?

Yeah, probably as the first action in scsifront_do_request().


Juergen

> 
> David
> 
>>> Signed-off-by: Bin Wu <wu.wubin@huawei.com>
>>> ---
>>>  drivers/scsi/xen-scsifront.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
>>> index 9dc8687..655163d 100644
>>> --- a/drivers/scsi/xen-scsifront.c
>>> +++ b/drivers/scsi/xen-scsifront.c
>>> @@ -565,6 +565,7 @@ static int scsifront_queuecommand(struct Scsi_Host
>>> *shost,
>>>      err = map_data_for_request(info, sc, ring_req, shadow);
>>>      if (err < 0) {
>>>          pr_debug("%s: err %d\n", __func__, err);
>>> +        info->ring.req_prod_pvt--;
>>>          scsifront_put_rqid(info, rqid);
>>>          scsifront_return(info);
>>>          spin_unlock_irqrestore(shost->host_lock, flags);
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> https://lists.xen.org/xen-devel
>>
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Xen-devel] [PATCH] xen_pvscsi: reclaim the ring request when mapping data failed
  2016-07-11  9:53     ` Juergen Gross
@ 2016-07-12  0:29       ` Bin Wu
  0 siblings, 0 replies; 5+ messages in thread
From: Bin Wu @ 2016-07-12  0:29 UTC (permalink / raw)
  To: Juergen Gross, David Vrabel, boris.ostrovsky, jejb,
	martin.petersen, xen-devel, linux-scsi, linux-kernel

On 2016/7/11 17:53, Juergen Gross wrote:
> On 11/07/16 11:50, David Vrabel wrote:
>> On 11/07/16 10:33, Juergen Gross wrote:
>>> On 11/07/16 04:51, Bin Wu wrote:
>>>> During scsi command queueing, if mapping data fails, we need to
>>>> reclaim the failed request. Otherwise, the garbage request will
>>>> be pushed into the ring for the backend to work.
>>> Well spotted. There is another instance of this problem in
>>> scsifront_action_handler(). Would you mind correcting this one, too?
>> Would it make more sense to advance req_prod_pvt only if the request has
>> been successfully created?
> Yeah, probably as the first action in scsifront_do_request().
>
>
> Juergen
ok, I will send a new patch : )
>
>> David
>>
>>>> Signed-off-by: Bin Wu <wu.wubin@huawei.com>
>>>> ---
>>>>   drivers/scsi/xen-scsifront.c | 1 +
>>>>   1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
>>>> index 9dc8687..655163d 100644
>>>> --- a/drivers/scsi/xen-scsifront.c
>>>> +++ b/drivers/scsi/xen-scsifront.c
>>>> @@ -565,6 +565,7 @@ static int scsifront_queuecommand(struct Scsi_Host
>>>> *shost,
>>>>       err = map_data_for_request(info, sc, ring_req, shadow);
>>>>       if (err < 0) {
>>>>           pr_debug("%s: err %d\n", __func__, err);
>>>> +        info->ring.req_prod_pvt--;
>>>>           scsifront_put_rqid(info, rqid);
>>>>           scsifront_return(info);
>>>>           spin_unlock_irqrestore(shost->host_lock, flags);
>>>
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xen.org
>>> https://lists.xen.org/xen-devel
>>>
>>
>
> .
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-12  0:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-11  2:51 [PATCH] xen_pvscsi: reclaim the ring request when mapping data failed Bin Wu
2016-07-11  9:33 ` Juergen Gross
2016-07-11  9:50   ` [Xen-devel] " David Vrabel
2016-07-11  9:53     ` Juergen Gross
2016-07-12  0:29       ` Bin Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).