On 11/29/23 07:46, Yuan Yao wrote:
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);
Thanks, I first need to fix all the issues Al found (and need to find
the time for that, hopefully during the next days) and will then add
this to my series.
(We also need to document for userspace that the atomic_open method
shall not fill in fi->fh in atomic-open, if it wants the no-open feature).
Thanks,
Bernd