[PATCH 1/1] fuse: Handle no_open/no_opendir in atomic_open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, if the fuse server supporting the no_open/no_opendir feature
uses atomic_open to open a file, the corresponding no_open/no_opendir
flag is not set in kernel. This leads to the kernel unnecessarily
sending extra FUSE_RELEASE request, receiving an empty reply from
server when closes that file.

This patch addresses the issue by setting the no_open/no_opendir feature
bit to true if the kernel receives a valid dentry with an empty file
handler.

Signed-off-by: Yuan Yao <yuanyaogoog@xxxxxxxxxxxx>
---
 fs/fuse/dir.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 9956fae7f875..edee4f715f39 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -8,6 +8,7 @@
 
 #include "fuse_i.h"
 
+#include <linux/fuse.h>
 #include <linux/pagemap.h>
 #include <linux/file.h>
 #include <linux/fs_context.h>
@@ -869,6 +870,13 @@ static int _fuse_atomic_open(struct inode *dir, struct dentry *entry,
 		goto out_err;
 	}
 
+	if (ff->fh == 0) {
+		if (ff->open_flags & FOPEN_KEEP_CACHE)
+			fc->no_open = 1;
+		if (ff->open_flags & FOPEN_CACHE_DIR)
+			fc->no_opendir = 1;
+	}
+
 	/* prevent racing/parallel lookup on a negative hashed */
 	if (!(flags & O_CREAT) && !d_in_lookup(entry)) {
 		d_drop(entry);
-- 
2.43.0.rc1.413.gea7ed67945-goog





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux