>From d9ef6ae45c80b298f7f3b718a101956071709b02 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Fri, 29 Mar 2013 18:05:01 +0100 Subject: [PATCH] direct-io: Submit bio after boundary buffer is added to it Currently, dio_send_cur_page() submits bio before current page (sdio->cur_page) is added to the bio if sdio->boundary is set. This is actually wrong because sdio->boundary means the current buffer is the last one before metadata needs to be read. So we should rather submit the bio *after* the current page is added to it. Reported-by: Kazuya Mio Signed-off-by: Jan Kara --- fs/direct-io.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index e666854..2ccde31 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -672,12 +672,6 @@ static inline int dio_send_cur_page(struct dio *dio, struct dio_submit *sdio, if (sdio->final_block_in_bio != sdio->cur_page_block || cur_offset != bio_next_offset) dio_bio_submit(dio, sdio); - /* - * Submit now if the underlying fs is about to perform a - * metadata read - */ - else if (sdio->boundary) - dio_bio_submit(dio, sdio); } if (sdio->bio == NULL) { @@ -694,6 +688,12 @@ static inline int dio_send_cur_page(struct dio *dio, struct dio_submit *sdio, BUG_ON(ret != 0); } } + /* + * Submit now if the underlying fs is about to perform a + * metadata read + */ + if (sdio->boundary) + dio_bio_submit(dio, sdio); out: return ret; } -- 1.7.1