]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.33/scsi-sd-quiesce-warning-if-device-does-not-report-optimal-i-o-size.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.19.33 / scsi-sd-quiesce-warning-if-device-does-not-report-optimal-i-o-size.patch
1 From 1d5de5bd311be7cd54f02f7cd164f0349a75c876 Mon Sep 17 00:00:00 2001
2 From: "Martin K. Petersen" <martin.petersen@oracle.com>
3 Date: Wed, 27 Mar 2019 12:11:52 -0400
4 Subject: scsi: sd: Quiesce warning if device does not report optimal I/O size
5
6 From: Martin K. Petersen <martin.petersen@oracle.com>
7
8 commit 1d5de5bd311be7cd54f02f7cd164f0349a75c876 upstream.
9
10 Commit a83da8a4509d ("scsi: sd: Optimal I/O size should be a multiple
11 of physical block size") split one conditional into several separate
12 statements in an effort to provide more accurate warning messages when
13 a device reports a nonsensical value. However, this reorganization
14 accidentally dropped the precondition of the reported value being
15 larger than zero. This lead to a warning getting emitted on devices
16 that do not report an optimal I/O size at all.
17
18 Remain silent if a device does not report an optimal I/O size.
19
20 Fixes: a83da8a4509d ("scsi: sd: Optimal I/O size should be a multiple of physical block size")
21 Cc: Randy Dunlap <rdunlap@infradead.org>
22 Cc: <stable@vger.kernel.org>
23 Reported-by: Hussam Al-Tayeb <ht990332@gmx.com>
24 Tested-by: Hussam Al-Tayeb <ht990332@gmx.com>
25 Reviewed-by: Bart Van Assche <bvanassche@acm.org>
26 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28
29 ---
30 drivers/scsi/sd.c | 3 +++
31 1 file changed, 3 insertions(+)
32
33 --- a/drivers/scsi/sd.c
34 +++ b/drivers/scsi/sd.c
35 @@ -3073,6 +3073,9 @@ static bool sd_validate_opt_xfer_size(st
36 unsigned int opt_xfer_bytes =
37 logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
38
39 + if (sdkp->opt_xfer_blocks == 0)
40 + return false;
41 +
42 if (sdkp->opt_xfer_blocks > dev_max) {
43 sd_first_printk(KERN_WARNING, sdkp,
44 "Optimal transfer size %u logical blocks " \