Skip to contentSkip to conversation

NFS: Ensure that buffered writes wait for O_DIRECT writes to complete

PATCH In review Trond Myklebust 2 participants 2 messages Feb 28, 2015 – Mar 2, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: Ensure that buffered writes wait for O_DIRECT writes to complete

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.

---
 fs/nfs/file.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/nfs/file.c +4 -0
index 94712fc781fa..c045c7169fa0 100644
@@ -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)
Signature · 1 line
2.1.0
#1 lore raw

Looks good to me.

-dros

Quoted 36 lines · Trond Myklebust

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.

---
fs/nfs/file.c | 4 ++++

1 file changed, 4 insertions(+)
fs/nfs/file.c +4 -0
index 94712fc781fa..c045c7169fa0 100644
@@ -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)
Signature · 6 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html