Skip to content

Commit bf5e3a3

Browse files
Christoph Hellwigaxboe
authored andcommitted
Revert "blk-lib: check for kill signal"
This reverts commit 8a08c5f. It turns out while this is a perfectly valid and long overdue thing to do for user initiated discards / zeroing from the ioctl handler, it actually breaks file system use of the discard helper by interrupting in places the file system doesn't expect, and by leaving the bio chain in a state that the file system callers of (at least) __blkdev_issue_discard do not expect. Revert the change for now, we'll redo it for the next merge window after refactoring the code to better split the file system vs ioctl callers and cleaning up a few other loose ends. Reported-by: Chandan Babu R <chandanbabu@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Keith Busch <kbusch@kernel.org> Link: https://lore.kernel.org/r/20240314021623.1908895-1-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 256aab4 commit bf5e3a3

File tree

1 file changed

+1
-39
lines changed

1 file changed

+1
-39
lines changed

block/blk-lib.c

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,6 @@ static sector_t bio_discard_limit(struct block_device *bdev, sector_t sector)
3535
return round_down(UINT_MAX, discard_granularity) >> SECTOR_SHIFT;
3636
}
3737

38-
static void await_bio_endio(struct bio *bio)
39-
{
40-
complete(bio->bi_private);
41-
bio_put(bio);
42-
}
43-
44-
/*
45-
* await_bio_chain - ends @bio and waits for every chained bio to complete
46-
*/
47-
static void await_bio_chain(struct bio *bio)
48-
{
49-
DECLARE_COMPLETION_ONSTACK_MAP(done,
50-
bio->bi_bdev->bd_disk->lockdep_map);
51-
52-
bio->bi_private = &done;
53-
bio->bi_end_io = await_bio_endio;
54-
bio_endio(bio);
55-
blk_wait_io(&done);
56-
}
57-
5838
int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
5939
sector_t nr_sects, gfp_t gfp_mask, struct bio **biop)
6040
{
@@ -97,10 +77,6 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
9777
* is disabled.
9878
*/
9979
cond_resched();
100-
if (fatal_signal_pending(current)) {
101-
await_bio_chain(bio);
102-
return -EINTR;
103-
}
10480
}
10581

10682
*biop = bio;
@@ -167,10 +143,6 @@ static int __blkdev_issue_write_zeroes(struct block_device *bdev,
167143
nr_sects -= len;
168144
sector += len;
169145
cond_resched();
170-
if (fatal_signal_pending(current)) {
171-
await_bio_chain(bio);
172-
return -EINTR;
173-
}
174146
}
175147

176148
*biop = bio;
@@ -215,10 +187,6 @@ static int __blkdev_issue_zero_pages(struct block_device *bdev,
215187
break;
216188
}
217189
cond_resched();
218-
if (fatal_signal_pending(current)) {
219-
await_bio_chain(bio);
220-
return -EINTR;
221-
}
222190
}
223191

224192
*biop = bio;
@@ -309,7 +277,7 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
309277
bio_put(bio);
310278
}
311279
blk_finish_plug(&plug);
312-
if (ret && ret != -EINTR && try_write_zeroes) {
280+
if (ret && try_write_zeroes) {
313281
if (!(flags & BLKDEV_ZERO_NOFALLBACK)) {
314282
try_write_zeroes = false;
315283
goto retry;
@@ -361,12 +329,6 @@ int blkdev_issue_secure_erase(struct block_device *bdev, sector_t sector,
361329
sector += len;
362330
nr_sects -= len;
363331
cond_resched();
364-
if (fatal_signal_pending(current)) {
365-
await_bio_chain(bio);
366-
ret = -EINTR;
367-
bio = NULL;
368-
break;
369-
}
370332
}
371333
if (bio) {
372334
ret = submit_bio_wait(bio);

0 commit comments

Comments
 (0)