diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2014-03-05 16:05:09 +0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-03-07 08:52:11 +0400 |
commit | 16c0ae028989df40bdab46b7f241d331ddc97c59 (patch) | |
tree | 425a754b9d8ee86b957760ddc1c9e781950bb731 /drivers/target/loopback | |
parent | ebbe442183b7b8192c963266f1c89048fefc63a5 (diff) | |
download | linux-16c0ae028989df40bdab46b7f241d331ddc97c59.tar.xz |
Target/sbc: Fix sbc_copy_prot for offset scatters
When copying between device and command protection scatters
we must take into account that device scatters might be offset
and we might copy outside scatter range. Thus for each cmd prot
scatter we must take the min between cmd prot scatter, dev prot
scatter, and whats left (and loop in case we havn't copied enough
from/to cmd prot scatter).
Example (single t_prot_sg of len 2048):
kernel: sbc_dif_copy_prot: se_cmd=ffff880380aaf970, left=2048, len=2048, dev_prot_sg_offset=3072, dev_prot_sg_len=4096
kernel: isert: se_cmd=ffff880380aaf970 PI error found type 0 at sector 0x2600 expected 0x0 vs actual 0x725f, lba=2580
Instead of copying 2048 from offset 3072 (copying junk outside sg
limit 4096), we must to copy 1024 and continue to next sg until
we complete cmd prot scatter.
This issue was found using iSER T10-PI offload over rd_mcp (wasn't
discovered with fileio since file_dev prot sglists are never offset).
Changes from v1:
- Fix sbc_copy_prot copy length miss-calculation
Changes from v0:
- Removed psg->offset consideration for psg_len computation
- Removed sg->offset consideration for offset condition
- Added copied consideraiton for len computation
- Added copied offset to paddr when doing memcpy
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/loopback')
0 files changed, 0 insertions, 0 deletions