public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-lib: let user kill a zereout process
@ 2024-02-20 20:41 Keith Busch
  2024-02-21  3:05 ` Chaitanya Kulkarni
  2024-02-21  8:46 ` Nilay Shroff
  0 siblings, 2 replies; 10+ messages in thread
From: Keith Busch @ 2024-02-20 20:41 UTC (permalink / raw)
  To: linux-block; +Cc: axboe, Keith Busch

From: Keith Busch <kbusch@kernel.org>

If a user runs something like `blkdiscard -z /dev/sda`, and the device
does not have an efficient write zero offload, the kernel will dispatch
long chains of bio's using the ZERO_PAGE for the entire capacity of the
device. If the capacity is very large, this process could take a long
time in an uninterruptable state, which the user may want to abort.
Check between batches for the user's request to kill the process so they
don't need to wait potentially many hours.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 block/blk-lib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/blk-lib.c b/block/blk-lib.c
index e59c3069e8351..d5c334aa98e0d 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -190,6 +190,8 @@ static int __blkdev_issue_zero_pages(struct block_device *bdev,
 				break;
 		}
 		cond_resched();
+		if (fatal_signal_pending(current))
+			break;
 	}
 
 	*biop = bio;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-02-21 16:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20 20:41 [PATCH] blk-lib: let user kill a zereout process Keith Busch
2024-02-21  3:05 ` Chaitanya Kulkarni
2024-02-21  3:16   ` Keith Busch
2024-02-21  3:21     ` Keith Busch
2024-02-21  5:32       ` Chaitanya Kulkarni
2024-02-21  8:54     ` Ming Lei
2024-02-21  9:45       ` Chaitanya Kulkarni
2024-02-21  8:46 ` Nilay Shroff
2024-02-21  9:46   ` Chaitanya Kulkarni
2024-02-21 16:27   ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox