Message ID | 1576078562-15240-1-git-send-email-israelr@mellanox.com (mailing list archive) |
---|---|
State | Accepted |
Commit | e4dc9a4c31fe10d1751c542702afc85be8a5c56a |
Headers | show |
Series | scsi: target/iblock: Fix protection error with sectors greater than 512B | expand |
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Israel, > The sector size of the block layer is 512 bytes, but integrity > interval size might be different (in case of 4K block size of the > media). At the initiator side the virtual start sector is the one that > was originally submitted by the block layer (512 bytes) for the Reftag > usage. The initiator converts the Reftag to integrity interval units > and sends it to the target. So the target virtual start sector should > be calculated at integrity interval units. prepare_fn() and > complete_fn() don't remap correctly the Reftag when using incorrect > units of the virtual start sector, which leads to the following > protection error at the device: Applied to 5.5/scsi-fixes, thanks!
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 6949ea8..51ffd5c 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -646,7 +646,9 @@ static ssize_t iblock_show_configfs_dev_params(struct se_device *dev, char *b) } bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio)); - bip_set_seed(bip, bio->bi_iter.bi_sector); + /* virtual start sector must be in integrity interval units */ + bip_set_seed(bip, bio->bi_iter.bi_sector >> + (bi->interval_exp - SECTOR_SHIFT)); pr_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size, (unsigned long long)bip->bip_iter.bi_sector);