Skip to contentSkip to conversation

NFS: flag files as supporting FMODE_NOWAIT

PATCH New Arik Rinberg 1 participant 1 message Apr 21

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

PATCH 1/1 NFS: flag files as supporting FMODE_NOWAIT

When opening a file in NFS, set FMODE_NOWAIT in filp->f_mode.

Without this flag, asynchronous I/O frameworks like io_uring assume that the file system does not support non-blocking I/O. This causes io_uring to punt all I/O operations to background io-wq worker threads to avoid blocking the main ring. This results in performance degredation.

By setting FMODE_NOWAIT, we inform the VFS that NFS supports asynchronous I/O natively, keeping execution on the fast path and restoring performance.

---
 fs/nfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/file.c +1 -1
index 5d08b6409c28..8e2100550f10 100644
@@ -73,7 +73,7 @@ nfs_file_open(struct inode *inode, struct file *filp)
 
 	res = nfs_open(inode, filp);
 	if (res == 0)
-		filp->f_mode |= FMODE_CAN_ODIRECT;
+		filp->f_mode |= FMODE_CAN_ODIRECT | FMODE_NOWAIT;
 	return res;
 }
 
Signature · 1 line
2.54.0.rc1.555.g9c883467ad-goog