All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFS: Ensure that buffered writes wait for O_DIRECT writes to complete
@ 2015-02-28  4:16 Trond Myklebust
  2015-03-02 21:05 ` Weston Andros Adamson
  0 siblings, 1 reply; 2+ messages in thread
From: Trond Myklebust @ 2015-02-28  4:16 UTC (permalink / raw)
  To: linux-nfs

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>
---
 fs/nfs/file.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 94712fc781fa..c045c7169fa0 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -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)
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] NFS: Ensure that buffered writes wait for O_DIRECT writes to complete
  2015-02-28  4:16 [PATCH] NFS: Ensure that buffered writes wait for O_DIRECT writes to complete Trond Myklebust
@ 2015-03-02 21:05 ` Weston Andros Adamson
  0 siblings, 0 replies; 2+ messages in thread
From: Weston Andros Adamson @ 2015-03-02 21:05 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs list

Looks good to me.

-dros



> On Feb 27, 2015, at 11:16 PM, Trond Myklebust <trond.myklebust@primarydata.com> wrote:
> 
> 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>
> ---
> fs/nfs/file.c | 4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/fs/nfs/file.c b/fs/nfs/file.c
> index 94712fc781fa..c045c7169fa0 100644
> --- a/fs/nfs/file.c
> +++ b/fs/nfs/file.c
> @@ -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)
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-02 21:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-28  4:16 [PATCH] NFS: Ensure that buffered writes wait for O_DIRECT writes to complete Trond Myklebust
2015-03-02 21:05 ` Weston Andros Adamson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.