[Devel] [PATCH rh7 02/38] ploop: fix dio_fsync wait

Andrey Smetanin asmetanin at virtuozzo.com
Fri May 15 09:48:03 PDT 2015


we MUST wait for writeback to finish before file->f_op->fsync.

https://jira.sw.ru/browse/PSBM-18049

Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
Acked-by: Maxim V. Patlasov <mpatlasov at parallels.com>
---
 drivers/block/ploop/io_direct.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index cbb7edc..a9910ba 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -774,16 +774,13 @@ static int dio_fsync(struct file * file)
 	int err, ret;
 	struct address_space *mapping = file->f_mapping;
 
-	ret = filemap_fdatawrite(mapping);
+	ret = filemap_write_and_wait(mapping);
 	err = 0;
 	if (file->f_op && file->f_op->fsync) {
 		err = file->f_op->FOP_FSYNC(file, 0);
 		if (!ret)
 			ret = err;
 	}
-	err = filemap_fdatawait(mapping);
-	if (!ret)
-		ret = err;
 	return ret;
 }
 
-- 
1.9.3




More information about the Devel mailing list