Ye Bin
8a7518931b
block: Fix fsync always failed if once failed
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 8d6996630c 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>
2021-11-29 06:46:04 -07:00
..
2021-11-29 06:38:35 -07:00
2020-08-23 17:36:59 -05:00
2021-11-29 06:41:29 -07:00
2021-10-19 15:18:30 -06:00
2021-11-29 06:41:29 -07:00
2021-11-29 06:38:52 -07:00
2021-08-18 07:21:12 -06:00
2021-10-18 06:17:37 -06:00
2021-10-27 06:54:58 -06:00
2021-03-05 11:32:15 -07:00
2019-11-07 12:28:13 -07:00
2021-11-29 06:38:44 -07:00
2021-11-29 06:38:44 -07:00
2021-10-21 10:49:32 -06:00
2021-10-18 06:17:02 -06:00
2021-11-29 06:38:51 -07:00
2021-10-21 10:49:32 -06:00
2021-11-29 06:46:04 -07:00
2021-11-11 11:52:30 -07:00
2021-11-29 06:38:51 -07:00
2021-11-29 06:41:29 -07:00
2021-10-18 06:17:37 -06:00
2021-10-18 06:17:01 -06:00
2021-11-29 06:38:35 -07:00
2021-06-21 15:03:40 -06:00
2021-06-17 15:51:20 +02:00
2021-09-03 10:08:28 -07:00
2021-11-29 06:41:29 -07:00
2020-10-20 07:08:17 -06:00
2019-01-17 21:21:40 -07:00
2021-11-29 06:38:44 -07: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-11-29 06:41:29 -07:00
2021-11-29 06:41:29 -07:00
2021-08-02 13:37:29 -06:00
2021-10-21 08:21:52 -06:00
2021-10-19 05:55:41 -06:00
2020-03-17 20:55:21 +01:00
2021-11-29 06:41:29 -07:00
2021-11-29 06:34:50 -07:00
2020-12-09 11:41:41 -05:00
2021-02-22 06:33:48 -07:00
2021-06-08 15:12:57 -06:00
2021-10-18 08:50:47 -06:00
2021-10-27 06:58:01 -06:00
2021-11-29 06:38:35 -07:00
2021-11-29 06:38:35 -07:00
2021-11-29 06:38:44 -07:00
2021-11-29 06:38:44 -07:00
2021-10-18 06:17:03 -06:00
2020-07-31 16:29:47 -06:00
2021-10-19 06:13:41 -06:00
2021-06-21 15:03:41 -06:00
2021-11-11 11:52:46 -07:00
2021-11-29 06:41:29 -07:00
2021-10-18 06:17:01 -06:00
2021-11-29 06:41:29 -07:00
2021-09-14 00:22:15 -04:00
2021-08-23 12:55:45 -06:00
2021-11-29 06:38:44 -07:00
2021-10-18 06:17:01 -06:00
2021-11-09 11:16:20 -08:00
2021-11-29 06:38:44 -07:00
2021-10-18 06:17:02 -06:00
2021-11-29 06:35:21 -07:00
2021-11-15 14:28:59 -07:00
2021-10-18 06:17:35 -06:00
2021-10-18 06:17:35 -06:00
2021-10-18 06:17:03 -06:00
2021-11-29 06:34:50 -07:00
2021-10-18 06:17:03 -06:00
2020-03-12 08:00:10 -06:00
2020-03-12 08:00:10 -06:00
2021-10-18 06:17:02 -06:00