* [PATCH 0/2] bcache fixes for Linux v5.18-rc3
@ 2022-04-19 16:04 Coly Li
2022-04-19 16:04 ` [PATCH 1/2] bcache: put bch_bio_map() back to correct location in journal_write_unlocked() Coly Li
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Coly Li @ 2022-04-19 16:04 UTC (permalink / raw)
To: axboe; +Cc: hch, kch, snitzer, linux-bcache, linux-block, Coly Li
Hi Jens,
There are two regressions introduced in the generic block layer changes
from Linux v5.18-rc1. Both of them may panic the kernel, please take
them for -rc4.
Thanks in advance.
Coly Li
---
Coly Li (2):
bcache: put bch_bio_map() back to correct location in
journal_write_unlocked()
bcache: fix wrong bdev parameter when calling bio_alloc_clone() in
do_bio_hook()
drivers/md/bcache/journal.c | 2 +-
drivers/md/bcache/request.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] bcache: put bch_bio_map() back to correct location in journal_write_unlocked()
2022-04-19 16:04 [PATCH 0/2] bcache fixes for Linux v5.18-rc3 Coly Li
@ 2022-04-19 16:04 ` Coly Li
2022-04-19 16:04 ` [PATCH 2/2] bcache: fix wrong bdev parameter when calling bio_alloc_clone() in do_bio_hook() Coly Li
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Coly Li @ 2022-04-19 16:04 UTC (permalink / raw)
To: axboe; +Cc: hch, kch, snitzer, linux-bcache, linux-block, Coly Li
Commit a7c50c940477 ("block: pass a block_device and opf to bio_reset")
moves bch_bio_map() inside journal_write_unlocked() next to the location
where the modified bio_reset() was called.
This change is wrong because calling bch_bio_map() immediately after
bio_reset(), a BUG_ON(!bio->bi_iter.bi_size) inside bch_bio_map() will
be triggered and panic the kernel.
This patch puts bch_bio_map() back to its original correct location in
journal_write_unlocked() and avoid the BUG_ON().
Fixes: a7c50c940477 ("block: pass a block_device and opf to bio_reset")
Signed-off-by: Coly Li <colyli@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/md/bcache/journal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 7c2ca52ca3e4..df5347ea450b 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -771,12 +771,12 @@ static void journal_write_unlocked(struct closure *cl)
bio_reset(bio, ca->bdev, REQ_OP_WRITE |
REQ_SYNC | REQ_META | REQ_PREFLUSH | REQ_FUA);
- bch_bio_map(bio, w->data);
bio->bi_iter.bi_sector = PTR_OFFSET(k, i);
bio->bi_iter.bi_size = sectors << 9;
bio->bi_end_io = journal_write_endio;
bio->bi_private = w;
+ bch_bio_map(bio, w->data);
trace_bcache_journal_write(bio, w->data->keys);
bio_list_add(&list, bio);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] bcache: fix wrong bdev parameter when calling bio_alloc_clone() in do_bio_hook()
2022-04-19 16:04 [PATCH 0/2] bcache fixes for Linux v5.18-rc3 Coly Li
2022-04-19 16:04 ` [PATCH 1/2] bcache: put bch_bio_map() back to correct location in journal_write_unlocked() Coly Li
@ 2022-04-19 16:04 ` Coly Li
2022-04-19 17:28 ` [PATCH 0/2] bcache fixes for Linux v5.18-rc3 Jens Axboe
2022-04-20 4:39 ` Christoph Hellwig
3 siblings, 0 replies; 5+ messages in thread
From: Coly Li @ 2022-04-19 16:04 UTC (permalink / raw)
To: axboe; +Cc: hch, kch, snitzer, linux-bcache, linux-block, Coly Li
Commit abfc426d1b2f ("block: pass a block_device to bio_clone_fast")
calls the modified bio_alloc_clone() in bcache code as:
bio_init_clone(bio->bi_bdev, bio, orig_bio, GFP_NOIO);
But the first parameter is wrong, where bio->bi_bdev should be
orig_bio->bi_bdev. The wrong bi_bdev panics the kernel when submitting
cache bio.
This patch fixes the wrong bdev parameter usage and avoid the panic.
Fixes: abfc426d1b2f ("block: pass a block_device to bio_clone_fast")
Signed-off-by: Coly Li <colyli@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Snitzer <snitzer@redhat.com>
---
drivers/md/bcache/request.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index fdd0194f84dd..320fcdfef48e 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -685,7 +685,7 @@ static void do_bio_hook(struct search *s,
{
struct bio *bio = &s->bio.bio;
- bio_init_clone(bio->bi_bdev, bio, orig_bio, GFP_NOIO);
+ bio_init_clone(orig_bio->bi_bdev, bio, orig_bio, GFP_NOIO);
/*
* bi_end_io can be set separately somewhere else, e.g. the
* variants in,
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] bcache fixes for Linux v5.18-rc3
2022-04-19 16:04 [PATCH 0/2] bcache fixes for Linux v5.18-rc3 Coly Li
2022-04-19 16:04 ` [PATCH 1/2] bcache: put bch_bio_map() back to correct location in journal_write_unlocked() Coly Li
2022-04-19 16:04 ` [PATCH 2/2] bcache: fix wrong bdev parameter when calling bio_alloc_clone() in do_bio_hook() Coly Li
@ 2022-04-19 17:28 ` Jens Axboe
2022-04-20 4:39 ` Christoph Hellwig
3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-04-19 17:28 UTC (permalink / raw)
To: colyli; +Cc: snitzer, linux-block, linux-bcache, Christoph Hellwig, kch
On Wed, 20 Apr 2022 00:04:23 +0800, Coly Li wrote:
> There are two regressions introduced in the generic block layer changes
> from Linux v5.18-rc1. Both of them may panic the kernel, please take
> them for -rc4.
>
> Thanks in advance.
>
> Coly Li
>
> [...]
Applied, thanks!
[1/2] bcache: put bch_bio_map() back to correct location in journal_write_unlocked()
commit: ff2695e52c9936febf65aa36a1769881da71bec5
[2/2] bcache: fix wrong bdev parameter when calling bio_alloc_clone() in do_bio_hook()
commit: 9dca4168a37c9cfe182f077f0d2289292e9e3656
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] bcache fixes for Linux v5.18-rc3
2022-04-19 16:04 [PATCH 0/2] bcache fixes for Linux v5.18-rc3 Coly Li
` (2 preceding siblings ...)
2022-04-19 17:28 ` [PATCH 0/2] bcache fixes for Linux v5.18-rc3 Jens Axboe
@ 2022-04-20 4:39 ` Christoph Hellwig
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-04-20 4:39 UTC (permalink / raw)
To: Coly Li; +Cc: axboe, hch, kch, snitzer, linux-bcache, linux-block
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-20 4:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-19 16:04 [PATCH 0/2] bcache fixes for Linux v5.18-rc3 Coly Li
2022-04-19 16:04 ` [PATCH 1/2] bcache: put bch_bio_map() back to correct location in journal_write_unlocked() Coly Li
2022-04-19 16:04 ` [PATCH 2/2] bcache: fix wrong bdev parameter when calling bio_alloc_clone() in do_bio_hook() Coly Li
2022-04-19 17:28 ` [PATCH 0/2] bcache fixes for Linux v5.18-rc3 Jens Axboe
2022-04-20 4:39 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).