Skip to content

Commit 1503140

Browse files
author
Jan Schmidt
committed
btrfs: Do not use bio->bi_bdev after submission
The block layer modifies bio->bi_bdev and bio->bi_sector while working on the bio, they do _not_ come back unmodified in the completion callback. To call add_page, we need at least some bi_bdev set, which is why the code was working, previously. With this patch, we use the latest_bdev from fsinfo instead of the leftover in the bio. This gives us the possibility to use the bi_bdev field for another purpose. Signed-off-by: Jan Schmidt <[email protected]>
1 parent a1d3c47 commit 1503140

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@ static int btrfs_io_failed_hook(struct bio *failed_bio,
19151915
bio->bi_private = state;
19161916
bio->bi_end_io = failed_bio->bi_end_io;
19171917
bio->bi_sector = failrec->logical >> 9;
1918-
bio->bi_bdev = failed_bio->bi_bdev;
1918+
bio->bi_bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev;
19191919
bio->bi_size = 0;
19201920

19211921
bio_add_page(bio, page, failrec->len, start - page_offset(page));

0 commit comments

Comments
 (0)