Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1610291
| From | Fam Zheng <famz@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2] sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable |
| Date | 2017-03-28 06:50 +0200 |
| Message-ID | <tpReV-2lO-1@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
If device reports a small max_xfer_blocks and a zero opt_xfer_blocks, we
end up using BLK_DEF_MAX_SECTORS, which is wrong and r/w of that size
may get error.
Fixes: ca369d51b3e ("block/sd: Fix device-imposed transfer length limits")
Signed-off-by: Fam Zheng <famz@redhat.com>
---
v2: Fix granularity mismatch. [Martin]
---
drivers/scsi/sd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index fcfeddc..a5c7e67 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2957,6 +2957,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
} else
rw_max = BLK_DEF_MAX_SECTORS;
+ rw_max = min_not_zero(rw_max, logical_to_sectors(sdp, dev_max));
/* Combine with controller limits */
q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q));
--
2.9.3
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2] sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable Fam Zheng <famz@redhat.com> - 2017-03-28 06:50 +0200
Re: [PATCH v2] sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-03-30 04:40 +0200
Re: [PATCH v2] sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable Fam Zheng <famz@redhat.com> - 2017-03-30 06:20 +0200
Re: [PATCH v2] sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-03-30 17:40 +0200
Re: [PATCH v2] sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable Fam Zheng <famz@redhat.com> - 2017-03-31 06:10 +0200
csiph-web