diff options
author | Bastian Blank <bastian@waldi.eu.org> | 2007-04-07 11:10:00 +0200 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-04-18 00:03:31 +0200 |
commit | ad1331a792f9f253bef362de9b6872c6b8f88c0c (patch) | |
tree | 188cc1e7384dfce2a97c9db493bc3067445c134e /drivers/scsi/libsrp.c | |
parent | [SCSI] aacraid: fix aacraid not finding device (diff) | |
download | linux-ad1331a792f9f253bef362de9b6872c6b8f88c0c.tar.xz linux-ad1331a792f9f253bef362de9b6872c6b8f88c0c.zip |
[SCSI] tgt: fix rdma transfer bugs
- ibmstgt hits the max rdma transfer size (128k).
- libsrp returns a rdma transfer error properly.
Signed-off-by: Bastian Blank <bastian@waldi.eu.org>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libsrp.c')
-rw-r--r-- | drivers/scsi/libsrp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c index 89403b00e042..37a0f4dd6186 100644 --- a/drivers/scsi/libsrp.c +++ b/drivers/scsi/libsrp.c @@ -225,8 +225,7 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, struct srp_direct_buf *md = NULL; struct scatterlist dummy, *sg = NULL; dma_addr_t token = 0; - long err; - unsigned int done = 0; + int err = 0; int nmd, nsg = 0, len; if (dma_map || ext_desc) { @@ -258,8 +257,8 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, sg_dma_address(&dummy) = token; err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, id->table_desc.len); - if (err < 0) { - eprintk("Error copying indirect table %ld\n", err); + if (err) { + eprintk("Error copying indirect table %d\n", err); goto free_mem; } } else { @@ -272,6 +271,7 @@ rdma: nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL); if (!nsg) { eprintk("fail to map %p %d\n", iue, sc->use_sg); + err = -EIO; goto free_mem; } len = min(sc->request_bufflen, id->len); @@ -287,7 +287,7 @@ free_mem: if (token && dma_map) dma_free_coherent(iue->target->dev, id->table_desc.len, md, token); - return done; + return err; } static int data_out_desc_size(struct srp_cmd *cmd) @@ -352,7 +352,7 @@ int srp_transfer_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, break; default: eprintk("Unknown format %d %x\n", dir, format); - break; + err = -EINVAL; } return err; |