Skip to contentSkip to conversation

xen_pvscsi: reclaim the ring request when mapping data failed

PATCH In review Bin Wu 3 participants 8 messages Jul 11, 2016 – Jul 12, 2016

Subsystems (3)
lore
Share & tools
lore

Bin Wu

author
#0 lore raw

PATCH 1/1 xen_pvscsi: reclaim the ring request when mapping data failed

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.

---
 drivers/scsi/xen-scsifront.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/xen-scsifront.c +1 -0
index 9dc8687..655163d 100644
@@ -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);
Signature · 1 line
2.3.2 (Apple Git-55)
maintainer
#1 lore raw
Quoted 3 lines · Bin Wu

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

Quoted 19 lines
---
 drivers/scsi/xen-scsifront.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/xen-scsifront.c +1 -0
index 9dc8687..655163d 100644
@@ -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 lore raw
Quoted 7 lines · Juergen Gross
Quoted 3 lines · Bin Wu

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

Quoted 25 lines
Quoted 17 lines
---
 drivers/scsi/xen-scsifront.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/xen-scsifront.c +1 -0
index 9dc8687..655163d 100644
@@ -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);
Quoted 1 line
         spin_unlock_irqrestore(shost->host_lock, flags);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

maintainer
#3 lore raw
Quoted 11 lines · David Vrabel
Quoted 7 lines · Juergen Gross
Quoted 3 lines · Bin Wu

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

Quoted 30 lines

David

Quoted 25 lines
Quoted 17 lines
---
 drivers/scsi/xen-scsifront.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/xen-scsifront.c +1 -0
index 9dc8687..655163d 100644
@@ -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);
Quoted 1 line
         spin_unlock_irqrestore(shost->host_lock, flags);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#4 lore raw
Quoted 6 lines · Juergen Gross
Quoted 5 lines · David Vrabel
Quoted 4 lines · Juergen Gross
Quoted 3 lines · Bin Wu

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.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

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 : )

Quoted 31 lines
Quoted 28 lines

David

Quoted 24 lines
Quoted 17 lines
---
  drivers/scsi/xen-scsifront.c | 1 +
  1 file changed, 1 insertion(+)
drivers/scsi/xen-scsifront.c +1 -0
index 9dc8687..655163d 100644
@@ -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);
Quoted 1 line
          spin_unlock_irqrestore(shost->host_lock, flags);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

.

author
#5 lore raw
In reply to Juergen Gross
Quoted 6 lines · Juergen Gross
Quoted 5 lines · David Vrabel
Quoted 4 lines · Juergen Gross
Quoted 3 lines · Bin Wu

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.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

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 : )

Quoted 29 lines
Quoted 28 lines

David

Quoted 24 lines
Quoted 17 lines
---
  drivers/scsi/xen-scsifront.c | 1 +
  1 file changed, 1 insertion(+)
drivers/scsi/xen-scsifront.c +1 -0
index 9dc8687..655163d 100644
@@ -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);
Quoted 1 line
          spin_unlock_irqrestore(shost->host_lock, flags);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Quoted 2 lines

.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
In reply to Juergen Gross
Quoted 7 lines · Juergen Gross
Quoted 3 lines · Bin Wu

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

Quoted 16 lines
Quoted 16 lines
---
 drivers/scsi/xen-scsifront.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/xen-scsifront.c +1 -0
index 9dc8687..655163d 100644
@@ -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);
Quoted 9 lines
Quoted 2 lines
drivers/scsi/xen-scsifront.c +0 -0
         scsifront_return(info);
         spin_unlock_irqrestore(shost->host_lock, flags);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

maintainer
#7 lore raw
In reply to Bin Wu
Quoted 3 lines · Bin Wu

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

Quoted 18 lines
---
 drivers/scsi/xen-scsifront.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/xen-scsifront.c +1 -0
index 9dc8687..655163d 100644
@@ -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);
Quoted 1 line
         spin_unlock_irqrestore(shost->host_lock, flags);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel