Message ID | 20170526085620.3113-8-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 05/26/2017 10:56 AM, Christoph Hellwig wrote: > Once we move the block layer to its own status code we'll still want to > propagate the bio_iov_iter_get_pages, so restructure __blkdev_direct_IO > to take ret into account when returning the errno. > --- -ENOSIGNOFF?
On Fri, May 26, 2017 at 11:12:31AM +0200, Johannes Thumshirn wrote: > On 05/26/2017 10:56 AM, Christoph Hellwig wrote: > > Once we move the block layer to its own status code we'll still want to > > propagate the bio_iov_iter_get_pages, so restructure __blkdev_direct_IO > > to take ret into account when returning the errno. > > --- > > > -ENOSIGNOFF? Fixed. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/block_dev.c b/fs/block_dev.c index 519599dddd36..c1dc393ad6b9 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -334,7 +334,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) bool is_read = (iov_iter_rw(iter) == READ), is_sync; loff_t pos = iocb->ki_pos; blk_qc_t qc = BLK_QC_T_NONE; - int ret; + int ret = 0; if ((pos | iov_iter_alignment(iter)) & (bdev_logical_block_size(bdev) - 1)) @@ -363,7 +363,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) ret = bio_iov_iter_get_pages(bio, iter); if (unlikely(ret)) { - bio->bi_error = ret; + bio->bi_error = -EIO; bio_endio(bio); break; } @@ -412,7 +412,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) } __set_current_state(TASK_RUNNING); - ret = dio->bio.bi_error; + if (!ret) + ret = dio->bio.bi_error; if (likely(!ret)) ret = dio->size;