blk-lib: check for kill signal in ioctl BLKZEROOUT
authorChristoph Hellwig <hch@lst.de>
Mon, 1 Jul 2024 16:51:20 +0000 (18:51 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 5 Jul 2024 06:53:15 +0000 (00:53 -0600)
commitbf86bcdb40123ee99669ee91b67e023669433a1a
tree96b195a2403a1d4a35028345b060aedaea0f7810
parent39722a2f2bcd82bdecc226711412d88b54fcb05b
blk-lib: check for kill signal in ioctl BLKZEROOUT

Zeroout can access a significant capacity and take longer than the user
expected.  A user may change their mind about wanting to run that
command and attempt to kill the process and do something else with their
device. But since the task is uninterruptable, they have to wait for it
to finish, which could be many hours.

Add a new BLKDEV_ZERO_KILLABLE flag for blkdev_issue_zeroout that checks
for a fatal signal at each iteration so the user doesn't have to wait for
their regretted operation to complete naturally.

Heavily based on an earlier patch from Keith Busch.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20240701165219.1571322-11-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-lib.c
block/ioctl.c
include/linux/blkdev.h