From: Pavel Emelyanov Date: Thu, 10 Oct 2013 13:12:05 +0000 (+0400) Subject: fuse: Fix O_DIRECT operations vs cached writeback misorder X-Git-Tag: v3.15-rc1~94^2~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea8cd33390fafc1eca06a26e6a9c7bf1d386526f;p=pandora-kernel.git fuse: Fix O_DIRECT operations vs cached writeback misorder The problem is: 1. write cached data to a file 2. read directly from the same file (via another fd) The 2nd operation may read stale data, i.e. the one that was in a file before the 1st op. Problem is in how fuse manages writeback. When direct op occurs the core kernel code calls filemap_write_and_wait to flush all the cached ops in flight. But fuse acks the writeback right after the ->writepages callback exits w/o waiting for the real write to happen. Thus the subsequent direct op proceeds while the real writeback is still in flight. This is a problem for backends that reorder operation. Fix this by making the fuse direct IO callback explicitly wait on the in-flight writeback to finish. Signed-off-by: Maxim Patlasov Signed-off-by: Miklos Szeredi --- Reading git-diff-tree failed