scsi: RDMA/srp: Don't set a max_segment_size when virt_boundary_mask is set
virt_boundary_mask implies an unlimited max_segment_size. Setting both can lead to data corruption because __blk_rq_map_sg() can split requests so that the virt_boundary_mask is not respected if max_segment_size is not UINT_MAX. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20250624125233.219635-2-hch@lst.de Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: John Garry <john.g.garry@oracle.com> Acked-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
8889676cd6
commit
844c6a160e
@@ -3705,9 +3705,10 @@ static ssize_t add_target_store(struct device *dev,
|
||||
target_host->max_id = 1;
|
||||
target_host->max_lun = -1LL;
|
||||
target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb;
|
||||
target_host->max_segment_size = ib_dma_max_seg_size(ibdev);
|
||||
|
||||
if (!(ibdev->attrs.kernel_cap_flags & IBK_SG_GAPS_REG))
|
||||
if (ibdev->attrs.kernel_cap_flags & IBK_SG_GAPS_REG)
|
||||
target_host->max_segment_size = ib_dma_max_seg_size(ibdev);
|
||||
else
|
||||
target_host->virt_boundary_mask = ~srp_dev->mr_page_mask;
|
||||
|
||||
target = host_to_target(target_host);
|
||||
|
||||
Reference in New Issue
Block a user