Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7207fea452cfdd2d4e2f4419e2c31f570edbade3
Commit:     7207fea452cfdd2d4e2f4419e2c31f570edbade3
Parent:     da32dd681f7a1a17073c42b375fc23cf73c92155
Author:     Boaz Harrosh <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 13 12:43:22 2007 -0600
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Fri Jan 11 18:28:22 2008 -0600

    [SCSI] iscsi: Prettify resid handling and some extra checks
    
      - Check to see that OVERFLOW is not negative indicating
        a bug.
      - Unify handling of UNDERFLOW and OVERFLOW to the same
        code.
      - Also handle BIDI_OVERFLOW.
    
    Signed-off-by: Boaz Harrosh <[EMAIL PROTECTED]>
    Signed-off-by: Mike Christie <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 drivers/scsi/iscsi_tcp.c |   16 +++++++---------
 drivers/scsi/libiscsi.c  |   12 +++++++-----
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 1b540e0..fd88777 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -507,22 +507,20 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct 
iscsi_cmd_task *ctask)
        }
 
        if (rhdr->flags & ISCSI_FLAG_DATA_STATUS) {
+               sc->result = (DID_OK << 16) | rhdr->cmd_status;
                conn->exp_statsn = be32_to_cpu(rhdr->statsn) + 1;
-               if (rhdr->flags & ISCSI_FLAG_DATA_UNDERFLOW) {
+               if (rhdr->flags & (ISCSI_FLAG_DATA_UNDERFLOW |
+                                  ISCSI_FLAG_DATA_OVERFLOW)) {
                        int res_count = be32_to_cpu(rhdr->residual_count);
 
                        if (res_count > 0 &&
-                           res_count <= scsi_bufflen(sc)) {
+                           (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW ||
+                            res_count <= scsi_bufflen(sc)))
                                scsi_set_resid(sc, res_count);
-                               sc->result = (DID_OK << 16) | rhdr->cmd_status;
-                       } else
+                       else
                                sc->result = (DID_BAD_TARGET << 16) |
                                        rhdr->cmd_status;
-               } else if (rhdr->flags & ISCSI_FLAG_DATA_OVERFLOW) {
-                       scsi_set_resid(sc, be32_to_cpu(rhdr->residual_count));
-                       sc->result = (DID_OK << 16) | rhdr->cmd_status;
-               } else
-                       sc->result = (DID_OK << 16) | rhdr->cmd_status;
+               }
        }
 
        conn->datain_pdus_cnt++;
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 176458f..0beb4c6 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -291,17 +291,19 @@ invalid_datalen:
                           min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE));
        }
 
-       if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) {
+       if (rhdr->flags & (ISCSI_FLAG_CMD_UNDERFLOW |
+                          ISCSI_FLAG_CMD_OVERFLOW)) {
                int res_count = be32_to_cpu(rhdr->residual_count);
 
-               if (res_count > 0 && res_count <= scsi_bufflen(sc))
+               if (res_count > 0 &&
+                   (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW ||
+                    res_count <= scsi_bufflen(sc)))
                        scsi_set_resid(sc, res_count);
                else
                        sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status;
-       } else if (rhdr->flags & ISCSI_FLAG_CMD_BIDI_UNDERFLOW)
+       } else if (rhdr->flags & (ISCSI_FLAG_CMD_BIDI_UNDERFLOW |
+                                 ISCSI_FLAG_CMD_BIDI_OVERFLOW))
                sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status;
-       else if (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW)
-               scsi_set_resid(sc, be32_to_cpu(rhdr->residual_count));
 
 out:
        debug_scsi("done [sc %lx res %d itt 0x%x]\n",
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to