The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-123.1.2.vz7.5.1 ------> commit 0ac13b3ba07b42573f151c21d9727a2cbcd415d1 Author: Andrey Smetanin <asmeta...@virtuozzo.com> Date: Tue May 19 08:27:00 2015 +0400
ploop: reverse order of fdatawait and fsync fop dio_fsync_thread must call filemap_fdatawrite() before file->f_op->fsync(). Otherwise: 8,0 6 82 0.003095587 12328 D WS 441706496 + 512 [ploop19054] 8,0 6 83 0.003103726 12328 D WS 441707008 + 512 [ploop19054] 8,0 6 84 0.003108627 12328 D WS 441707520 + 512 [ploop19054] 8,0 6 85 0.003113176 12328 D WS 441708032 + 512 [ploop19054] ... 8,0 6 102 0.003149386 1299 D WS 3950526248 + 24 [jbd2/dm-1-8] ... 8,0 6 103 0.003305550 0 C WS 441706496 + 512 [0] 8,0 6 104 0.003458057 0 C WS 441707008 + 512 [0] 8,0 6 105 0.003608325 0 C WS 441707520 + 512 [0] 8,0 6 106 0.003758297 0 C WS 441708032 + 512 [0] 8,0 6 107 0.003794543 0 C WS 3950526248 + 24 [0] And if the node crashes (or reboot happens) after last dispatch, journal data may come to the disk while user bulk data -- not. The result would be ploop image corruption. The patch re-arranges the sequence of calls to make it safe and natural (the same way as in vfs_fsync_range()). Signed-off-by: Maxim Patlasov <mpatla...@parallels.com> --- drivers/block/ploop/io_direct.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c index babc940..c18d2f0 100644 --- a/drivers/block/ploop/io_direct.c +++ b/drivers/block/ploop/io_direct.c @@ -735,14 +735,13 @@ static int dio_fsync_thread(void * data) spin_unlock_irq(&plo->lock); /* filemap_fdatawrite() has been made already */ + filemap_fdatawait(io->files.mapping); err = 0; if (io->files.file->f_op->fsync) err = io->files.file->f_op->FOP_FSYNC(io->files.file, 0); - filemap_fdatawait(io->files.mapping); - /* Do we need to invalidate page cache? Not really, * because we use it only to create full new pages, * which we overwrite completely. Probably, we should _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel