blk-mq-dio: move partition remap AFTER adding bio payload blk-dio
authorJens Axboe <axboe@fb.com>
Tue, 23 Aug 2016 14:24:37 +0000 (08:24 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 8 Sep 2016 18:10:26 +0000 (12:10 -0600)
Otherwise the bio will be empty, and blk_partition_remap() won't
do anything. Oops, caused corruption.

Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-dio.c

index cde205ecf5f42c64e0a2c17a281c76083f4408a5..76c3329750019d550966a94055568990ea62aa5b 100644 (file)
@@ -280,7 +280,6 @@ ssize_t blk_direct_IO(struct kiocb *iocb, struct inode *inode,
        bio = bio_alloc(GFP_KERNEL, (ret + pgoff + PAGE_SIZE - 1) >> PAGE_SHIFT);
        bio->bi_bdev = bdev;
        bio->bi_iter.bi_sector = offset >> blkbits;
-       blk_partition_remap(bio);
 
        total_len = ret;
        i = ret = 0;
@@ -300,6 +299,8 @@ ssize_t blk_direct_IO(struct kiocb *iocb, struct inode *inode,
                i++;
        }
 
+       blk_partition_remap(bio);
+
        if (iov_iter_rw(iter) == WRITE) {
                op = REQ_OP_WRITE;
                op_flags = WRITE_ODIRECT;