Ye Bin
fa84d44df4
block: Fix fsync always failed if once failed
...
commit 8a7518931baa8ea023700987f3db31cb0a80610b upstream.
We do test with inject error fault base on v4.19, after test some time we found
sync /dev/sda always failed.
[root@localhost] sync /dev/sda
sync: error syncing '/dev/sda': Input/output error
scsi log as follows:
[19069.812296] sd 0:0:0:0: [sda] tag#64 Send: scmd 0x00000000d03a0b6b
[19069.812302] sd 0:0:0:0: [sda] tag#64 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00
[19069.812533] sd 0:0:0:0: [sda] tag#64 Done: SUCCESS Result: hostbyte=DID_OK driverbyte=DRIVER_OK
[19069.812536] sd 0:0:0:0: [sda] tag#64 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00
[19069.812539] sd 0:0:0:0: [sda] tag#64 scsi host busy 1 failed 0
[19069.812542] sd 0:0:0:0: Notifying upper driver of completion (result 0)
[19069.812546] sd 0:0:0:0: [sda] tag#64 sd_done: completed 0 of 0 bytes
[19069.812549] sd 0:0:0:0: [sda] tag#64 0 sectors total, 0 bytes done.
[19069.812564] print_req_error: I/O error, dev sda, sector 0
ftrace log as follows:
rep-306069 [007] .... 19654.923315: block_bio_queue: 8,0 FWS 0 + 0 [rep]
rep-306069 [007] .... 19654.923333: block_getrq: 8,0 FWS 0 + 0 [rep]
kworker/7:1H-250 [007] .... 19654.923352: block_rq_issue: 8,0 FF 0 () 0 + 0 [kworker/7:1H]
<idle>-0 [007] ..s. 19654.923562: block_rq_complete: 8,0 FF () 18446744073709551615 + 0 [0]
<idle>-0 [007] d.s. 19654.923576: block_rq_complete: 8,0 WS () 0 + 0 [-5]
As 8d6996630c03 introduce 'fq->rq_status', this data only update when 'flush_rq'
reference count isn't zero. If flush request once failed and record error code
in 'fq->rq_status'. If there is no chance to update 'fq->rq_status',then do fsync
will always failed.
To address this issue reset 'fq->rq_status' after return error code to upper layer.
Fixes: 8d6996630c03("block: fix null pointer dereference in blk_mq_rq_timed_out()")
Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20211129012659.1553733-1-yebin10@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-08 19:07:47 +01:00
..
2019-07-15 11:03:02 -03:00
2019-04-30 16:11:57 -06:00
2020-09-03 11:26:54 +02:00
2022-02-23 11:59:59 +01:00
2020-09-03 11:26:54 +02:00
2020-09-03 11:26:54 +02:00
2022-02-08 18:24:28 +01:00
2022-02-01 17:24:39 +01:00
2021-09-30 10:09:25 +02:00
2021-02-07 15:35:47 +01:00
2019-04-30 16:12:03 -06:00
2022-03-08 19:07:47 +01:00
2019-09-17 20:03:49 -06:00
2020-04-17 10:50:04 +02:00
2020-09-09 19:12:35 +02:00
2021-08-12 13:20:58 +02:00
2018-11-14 08:17:18 -07:00
2020-01-12 12:21:43 +01:00
2021-07-14 16:53:19 +02:00
2019-08-04 21:43:12 -06:00
2019-01-17 21:21:40 -07:00
2020-07-22 09:32:52 +02:00
2019-06-13 03:00:30 -06:00
2019-05-31 15:12:34 -06:00
2019-05-31 15:12:34 -06:00
2021-05-19 10:08:30 +02:00
2020-09-23 12:40:37 +02:00
2020-10-29 09:57:34 +01:00
2019-08-04 21:41:29 -06:00
2017-11-14 15:32:19 -08:00
2019-05-31 15:12:34 -06:00
2021-11-17 09:48:31 +01:00
2020-03-21 08:11:52 +01:00
2021-01-06 14:48:37 +01:00
2018-11-15 12:17:28 -07:00
2021-07-19 08:53:16 +02:00
2021-07-14 16:53:18 +02:00
2021-03-04 10:26:40 +01:00
2018-11-15 12:13:25 -07:00
2019-04-30 16:12:03 -06:00
2018-12-12 06:47:51 -07:00
2020-10-29 09:57:34 +01:00
2021-09-26 14:07:13 +02:00
2019-04-30 16:12:03 -06:00
2021-07-14 16:53:25 +02:00
2021-07-14 16:53:25 +02:00
2021-09-22 12:26:19 +02:00
2020-01-26 10:01:09 +01:00
2019-04-30 09:26:13 -06:00
2020-01-23 08:22:44 +01:00
2021-09-22 12:26:23 +02:00
2017-11-02 11:10:55 +01:00
2020-01-09 10:19:58 +01:00
2022-02-23 11:59:59 +01:00
2021-03-30 14:35:23 +02:00
2019-04-30 16:12:03 -06:00
2021-12-14 14:49:02 +01:00
2019-08-28 21:17:12 -06:00
2019-07-15 09:20:27 -03:00
2021-05-19 10:08:30 +02:00
2019-08-28 21:17:12 -06:00
2021-05-19 10:08:30 +02:00
2019-08-20 09:34:49 -06:00
2019-04-22 09:48:12 -06:00
2019-04-30 16:11:57 -06:00
2019-10-03 14:21:32 -06:00
2019-09-23 08:05:19 -06:00