From: Jens Axboe Date: Wed, 13 Jun 2018 22:54:51 +0000 (-0600) Subject: block: kill read-ahead if the submitting process is getting killed X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=refs%2Fheads%2Freadpages-ahead-args;p=linux-2.6-block.git block: kill read-ahead if the submitting process is getting killed If we have tons of read-ahead coming in and the process is getting killed, then it can take forever to kill said process since each IO could take seconds on a loaded rotating drive. Signed-off-by: Jens Axboe --- diff --git a/block/blk-core.c b/block/blk-core.c index cf0ee764b908..839401541da3 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -35,6 +35,7 @@ #include #include #include +#include #define CREATE_TRACE_POINTS #include @@ -2530,6 +2531,13 @@ blk_qc_t submit_bio(struct bio *bio) if (bio_has_data(bio)) { unsigned int count; + if (unlikely((bio->bi_opf & REQ_RAHEAD) && + fatal_signal_pending(current))) { + bio->bi_status = BLK_STS_AGAIN; + bio_endio(bio); + return BLK_QC_T_NONE; + } + if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME)) count = queue_logical_block_size(bio->bi_disk->queue) >> 9; else