Skip to content

Commit ff2695e

Browse files
Coly Liaxboe
authored andcommitted
bcache: put bch_bio_map() back to correct location in journal_write_unlocked()
Commit a7c50c9 ("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: a7c50c9 ("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> Link: https://lore.kernel.org/r/20220419160425.4148-2-colyli@suse.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 89a2ee9 commit ff2695e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/bcache/journal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,12 @@ static void journal_write_unlocked(struct closure *cl)
771771

772772
bio_reset(bio, ca->bdev, REQ_OP_WRITE |
773773
REQ_SYNC | REQ_META | REQ_PREFLUSH | REQ_FUA);
774-
bch_bio_map(bio, w->data);
775774
bio->bi_iter.bi_sector = PTR_OFFSET(k, i);
776775
bio->bi_iter.bi_size = sectors << 9;
777776

778777
bio->bi_end_io = journal_write_endio;
779778
bio->bi_private = w;
779+
bch_bio_map(bio, w->data);
780780

781781
trace_bcache_journal_write(bio, w->data->keys);
782782
bio_list_add(&list, bio);

0 commit comments

Comments
 (0)