From acff7227ff55a5d5db78d56e813ef85ab1827d0b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Aug 2016 08:24:37 -0600 Subject: [PATCH] blk-mq-dio: move partition remap AFTER adding bio payload Otherwise the bio will be empty, and blk_partition_remap() won't do anything. Oops, caused corruption. Signed-off-by: Jens Axboe --- block/blk-mq-dio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-dio.c b/block/blk-mq-dio.c index cde205ecf5f4..76c332975001 100644 --- a/block/blk-mq-dio.c +++ b/block/blk-mq-dio.c @@ -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; -- 2.25.1