]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
NFS: Ensure that buffered writes wait for O_DIRECT writes to complete
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 28 Feb 2015 03:54:19 +0000 (22:54 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 2 Mar 2015 04:22:40 +0000 (23:22 -0500)
The O_DIRECT code will grab the inode->i_mutex and flush out buffered
writes, before scheduling a read or a write. However there is no
equivalent in the buffered write code to wait for O_DIRECT to complete.

Fixes a reported issue in xfstests generic/133, when first performing an
O_DIRECT write followed by a buffered write.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Tested-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfs/file.c

index 94712fc781fa58fa162c8399c6b9427aa242f5ce..c045c7169fa0f7f6ad442e9bc6d6c5fd24c77e2f 100644 (file)
@@ -372,6 +372,10 @@ start:
                                 nfs_wait_bit_killable, TASK_KILLABLE);
        if (ret)
                return ret;
+       /*
+        * Wait for O_DIRECT to complete
+        */
+       nfs_inode_dio_wait(mapping->host);
 
        page = grab_cache_page_write_begin(mapping, index, flags);
        if (!page)