Ye Bin
6a139c9ec5
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:04:08 +01:00
..
2018-07-27 09:17:41 -06:00
2017-11-03 11:29:50 -07:00
2020-03-25 08:06:08 +01:00
2022-02-23 11:58:40 +01:00
2021-12-29 12:20:43 +01:00
2021-12-29 12:20:43 +01:00
2022-02-08 18:23:14 +01:00
2021-04-16 11:49:30 +02:00
2021-08-08 08:54:29 +02:00
2021-03-04 09:39:30 +01:00
2018-01-17 09:49:21 -07:00
2022-03-08 19:04:08 +01:00
2018-05-24 13:38:59 -06:00
2020-04-17 10:48:41 +02:00
2021-08-12 13:19:40 +02:00
2020-02-01 09:37:12 +00:00
2020-01-12 12:17:22 +01:00
2020-01-27 14:50:23 +01:00
2018-04-10 08:38:46 -06:00
2018-07-09 09:07:52 -06:00
2019-08-04 09:30:57 +02:00
2018-07-09 09:07:52 -06:00
2018-07-09 09:07:53 -06:00
2017-08-08 14:58:03 -04:00
2020-09-03 11:24:26 +02:00
2019-01-13 09:51:07 +01:00
2021-03-04 09:39:30 +01:00
2018-09-25 20:17:59 -06:00
2017-11-14 15:32:19 -08:00
2017-02-27 20:54:05 +02:00
2021-05-22 10:59:46 +02:00
2019-09-16 08:22:13 +02:00
2019-10-17 13:45:16 -07:00
2019-10-29 09:20:09 +01:00
2021-03-04 09:39:51 +01:00
2018-06-19 11:27:18 -06:00
2018-07-09 09:07:54 -06:00
2019-01-13 09:51:06 +01:00
2021-03-04 09:39:30 +01:00
2018-06-17 05:37:55 +09:00
2021-09-26 13:39:49 +02:00
2018-06-23 10:25:45 -06:00
2021-07-20 16:15:48 +02:00
2021-07-20 16:15:48 +02:00
2021-09-22 11:47:57 +02:00
2021-03-04 09:39:30 +01:00
2018-12-01 09:37:32 +01:00
2018-08-01 09:13:03 -06:00
2018-08-27 19:17:02 -06:00
2018-08-07 17:57:13 -06:00
2017-11-02 11:10:55 +01:00
2020-01-09 10:19:01 +01:00
2018-05-24 13:38:59 -06:00
2022-02-23 11:58:40 +01:00
2021-03-30 14:36:59 +02:00
2018-02-23 15:20:19 -07:00
2021-12-14 10:18:07 +01:00
2018-07-09 09:07:54 -06:00
2017-11-02 11:10:55 +01:00
2018-05-30 10:47:40 -06:00
2018-07-09 09:07:54 -06:00
2019-10-07 18:57:19 +02:00
2017-01-17 10:03:33 -07:00
2017-09-11 09:45:52 -06:00
2019-05-31 06:46:18 -07:00
2018-05-14 08:55:18 -06:00
2019-05-31 06:46:24 -07:00
2018-07-30 08:27:02 -06:00