[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220608104202.19461-1-zhangjiachen.jaycee@bytedance.com>
Date: Wed, 8 Jun 2022 18:42:02 +0800
From: Jiachen Zhang <zhangjiachen.jaycee@...edance.com>
To: miklos@...redi.hu
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiachen Zhang <zhangjiachen.jaycee@...edance.com>
Subject: [PATCH] fuse: add FOPEN_INVAL_ATTR
So that the fuse daemon can ask kernel to invalidate the attr cache on file
open.
Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@...edance.com>
---
fs/fuse/file.c | 4 ++++
include/uapi/linux/fuse.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index fdcec3aa7830..9609d13ec351 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -213,6 +213,10 @@ void fuse_finish_open(struct inode *inode, struct file *file)
file_update_time(file);
fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
}
+
+ if (ff->open_flags & FOPEN_INVAL_ATTR)
+ fuse_invalidate_attr(inode);
+
if ((file->f_mode & FMODE_WRITE) && fc->writeback_cache)
fuse_link_write_file(file);
}
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index d6ccee961891..0b0b7d308ddb 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -301,6 +301,7 @@ struct fuse_file_lock {
* FOPEN_CACHE_DIR: allow caching this directory
* FOPEN_STREAM: the file is stream-like (no file position at all)
* FOPEN_NOFLUSH: don't flush data cache on close (unless FUSE_WRITEBACK_CACHE)
+ * FOPEN_INVAL_ATTR: invalidate the attr cache on open
*/
#define FOPEN_DIRECT_IO (1 << 0)
#define FOPEN_KEEP_CACHE (1 << 1)
@@ -308,6 +309,7 @@ struct fuse_file_lock {
#define FOPEN_CACHE_DIR (1 << 3)
#define FOPEN_STREAM (1 << 4)
#define FOPEN_NOFLUSH (1 << 5)
+#define FOPEN_INVAL_ATTR (1 << 6)
/**
* INIT request/reply flags
--
2.20.1
Powered by blists - more mailing lists