diff options
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 76555b1ddfd5..8aeaad95242c 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -109,6 +109,16 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size, | |||
109 | task->task_status.stat == SAM_GOOD) { | 109 | task->task_status.stat == SAM_GOOD) { |
110 | res = 0; | 110 | res = 0; |
111 | break; | 111 | break; |
112 | } if (task->task_status.resp == SAS_TASK_COMPLETE && | ||
113 | task->task_status.stat == SAS_DATA_UNDERRUN) { | ||
114 | /* no error, but return the number of bytes of | ||
115 | * underrun */ | ||
116 | res = task->task_status.residual; | ||
117 | break; | ||
118 | } if (task->task_status.resp == SAS_TASK_COMPLETE && | ||
119 | task->task_status.stat == SAS_DATA_OVERRUN) { | ||
120 | res = -EMSGSIZE; | ||
121 | break; | ||
112 | } else { | 122 | } else { |
113 | SAS_DPRINTK("%s: task to dev %016llx response: 0x%x " | 123 | SAS_DPRINTK("%s: task to dev %016llx response: 0x%x " |
114 | "status 0x%x\n", __FUNCTION__, | 124 | "status 0x%x\n", __FUNCTION__, |
@@ -1924,6 +1934,15 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1924 | 1934 | ||
1925 | ret = smp_execute_task(dev, bio_data(req->bio), req->data_len, | 1935 | ret = smp_execute_task(dev, bio_data(req->bio), req->data_len, |
1926 | bio_data(rsp->bio), rsp->data_len); | 1936 | bio_data(rsp->bio), rsp->data_len); |
1937 | if (ret > 0) { | ||
1938 | /* positive number is the untransferred residual */ | ||
1939 | rsp->data_len = ret; | ||
1940 | req->data_len = 0; | ||
1941 | ret = 0; | ||
1942 | } else if (ret == 0) { | ||
1943 | rsp->data_len = 0; | ||
1944 | req->data_len = 0; | ||
1945 | } | ||
1927 | 1946 | ||
1928 | return ret; | 1947 | return ret; |
1929 | } | 1948 | } |