]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: Do not use bio->bi_bdev after submission
authorJan Schmidt <list.btrfs@jan-o-sch.net>
Thu, 16 Jun 2011 12:37:03 +0000 (14:37 +0200)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 01:33:56 +0000 (20:33 -0500)
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 <list.btrfs@jan-o-sch.net>
(cherry picked from commit 1503140d3ec2be9b917d2f8f7c64cb77b79a215b)

fs/btrfs/inode.c

index 95f2d1cf177c09ebaa7cdf7a903241cc123b45f6..22f29ed3101cc40f42d5b04ebe31f75a46529239 100644 (file)
@@ -1915,7 +1915,7 @@ static int btrfs_io_failed_hook(struct bio *failed_bio,
        bio->bi_private = state;
        bio->bi_end_io = failed_bio->bi_end_io;
        bio->bi_sector = failrec->logical >> 9;
-       bio->bi_bdev = failed_bio->bi_bdev;
+       bio->bi_bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev;
        bio->bi_size = 0;
 
        bio_add_page(bio, page, failrec->len, start - page_offset(page));