[PATCH v2 5/6] libfs: set FMODE_NOWAIT on dir open

From: Dominique Martinet
Date: Wed May 10 2023 - 06:53:59 EST


the readdir can technically wait a bit on a spinlock, but that should
never wait for long enough to return EAGAIN -- just set the capability
flag on directories f_mode

Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
---
fs/libfs.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/libfs.c b/fs/libfs.c
index 89cf614a3271..a3c7e42d90a7 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -81,6 +81,7 @@ EXPORT_SYMBOL(simple_lookup);
int dcache_dir_open(struct inode *inode, struct file *file)
{
file->private_data = d_alloc_cursor(file->f_path.dentry);
+ file->f_mode |= FMODE_NOWAIT;

return file->private_data ? 0 : -ENOMEM;
}

--
2.39.2