diff options
| -rw-r--r-- | fs/fuse/fuse_i.h | 3 | ||||
| -rw-r--r-- | fs/fuse/inode.c | 7 | ||||
| -rw-r--r-- | include/uapi/linux/fuse.h | 7 |
3 files changed, 14 insertions, 3 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index e6195bc8f836..24dbca777775 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
| @@ -694,6 +694,9 @@ struct fuse_conn { | |||
| 694 | /** Use enhanced/automatic page cache invalidation. */ | 694 | /** Use enhanced/automatic page cache invalidation. */ |
| 695 | unsigned auto_inval_data:1; | 695 | unsigned auto_inval_data:1; |
| 696 | 696 | ||
| 697 | /** Filesystem is fully reponsible for page cache invalidation. */ | ||
| 698 | unsigned explicit_inval_data:1; | ||
| 699 | |||
| 697 | /** Does the filesystem support readdirplus? */ | 700 | /** Does the filesystem support readdirplus? */ |
| 698 | unsigned do_readdirplus:1; | 701 | unsigned do_readdirplus:1; |
| 699 | 702 | ||
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 36981ea7eac0..c67b39e88fd5 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
| @@ -237,7 +237,8 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, | |||
| 237 | 237 | ||
| 238 | if (oldsize != attr->size) { | 238 | if (oldsize != attr->size) { |
| 239 | truncate_pagecache(inode, attr->size); | 239 | truncate_pagecache(inode, attr->size); |
| 240 | inval = true; | 240 | if (!fc->explicit_inval_data) |
| 241 | inval = true; | ||
| 241 | } else if (fc->auto_inval_data) { | 242 | } else if (fc->auto_inval_data) { |
| 242 | struct timespec64 new_mtime = { | 243 | struct timespec64 new_mtime = { |
| 243 | .tv_sec = attr->mtime, | 244 | .tv_sec = attr->mtime, |
| @@ -912,6 +913,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) | |||
| 912 | fc->dont_mask = 1; | 913 | fc->dont_mask = 1; |
| 913 | if (arg->flags & FUSE_AUTO_INVAL_DATA) | 914 | if (arg->flags & FUSE_AUTO_INVAL_DATA) |
| 914 | fc->auto_inval_data = 1; | 915 | fc->auto_inval_data = 1; |
| 916 | else if (arg->flags & FUSE_EXPLICIT_INVAL_DATA) | ||
| 917 | fc->explicit_inval_data = 1; | ||
| 915 | if (arg->flags & FUSE_DO_READDIRPLUS) { | 918 | if (arg->flags & FUSE_DO_READDIRPLUS) { |
| 916 | fc->do_readdirplus = 1; | 919 | fc->do_readdirplus = 1; |
| 917 | if (arg->flags & FUSE_READDIRPLUS_AUTO) | 920 | if (arg->flags & FUSE_READDIRPLUS_AUTO) |
| @@ -973,7 +976,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req) | |||
| 973 | FUSE_WRITEBACK_CACHE | FUSE_NO_OPEN_SUPPORT | | 976 | FUSE_WRITEBACK_CACHE | FUSE_NO_OPEN_SUPPORT | |
| 974 | FUSE_PARALLEL_DIROPS | FUSE_HANDLE_KILLPRIV | FUSE_POSIX_ACL | | 977 | FUSE_PARALLEL_DIROPS | FUSE_HANDLE_KILLPRIV | FUSE_POSIX_ACL | |
| 975 | FUSE_ABORT_ERROR | FUSE_MAX_PAGES | FUSE_CACHE_SYMLINKS | | 978 | FUSE_ABORT_ERROR | FUSE_MAX_PAGES | FUSE_CACHE_SYMLINKS | |
| 976 | FUSE_NO_OPENDIR_SUPPORT; | 979 | FUSE_NO_OPENDIR_SUPPORT | FUSE_EXPLICIT_INVAL_DATA; |
| 977 | req->in.h.opcode = FUSE_INIT; | 980 | req->in.h.opcode = FUSE_INIT; |
| 978 | req->in.numargs = 1; | 981 | req->in.numargs = 1; |
| 979 | req->in.args[0].size = sizeof(*arg); | 982 | req->in.args[0].size = sizeof(*arg); |
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 2ac598614a8f..36899cfcb654 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h | |||
| @@ -125,6 +125,9 @@ | |||
| 125 | * | 125 | * |
| 126 | * 7.29 | 126 | * 7.29 |
| 127 | * - add FUSE_NO_OPENDIR_SUPPORT flag | 127 | * - add FUSE_NO_OPENDIR_SUPPORT flag |
| 128 | * | ||
| 129 | * 7.30 | ||
| 130 | * - add FUSE_EXPLICIT_INVAL_DATA | ||
| 128 | */ | 131 | */ |
| 129 | 132 | ||
| 130 | #ifndef _LINUX_FUSE_H | 133 | #ifndef _LINUX_FUSE_H |
| @@ -160,7 +163,7 @@ | |||
| 160 | #define FUSE_KERNEL_VERSION 7 | 163 | #define FUSE_KERNEL_VERSION 7 |
| 161 | 164 | ||
| 162 | /** Minor version number of this interface */ | 165 | /** Minor version number of this interface */ |
| 163 | #define FUSE_KERNEL_MINOR_VERSION 29 | 166 | #define FUSE_KERNEL_MINOR_VERSION 30 |
| 164 | 167 | ||
| 165 | /** The node ID of the root inode */ | 168 | /** The node ID of the root inode */ |
| 166 | #define FUSE_ROOT_ID 1 | 169 | #define FUSE_ROOT_ID 1 |
| @@ -263,6 +266,7 @@ struct fuse_file_lock { | |||
| 263 | * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages | 266 | * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages |
| 264 | * FUSE_CACHE_SYMLINKS: cache READLINK responses | 267 | * FUSE_CACHE_SYMLINKS: cache READLINK responses |
| 265 | * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir | 268 | * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir |
| 269 | * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request | ||
| 266 | */ | 270 | */ |
| 267 | #define FUSE_ASYNC_READ (1 << 0) | 271 | #define FUSE_ASYNC_READ (1 << 0) |
| 268 | #define FUSE_POSIX_LOCKS (1 << 1) | 272 | #define FUSE_POSIX_LOCKS (1 << 1) |
| @@ -289,6 +293,7 @@ struct fuse_file_lock { | |||
| 289 | #define FUSE_MAX_PAGES (1 << 22) | 293 | #define FUSE_MAX_PAGES (1 << 22) |
| 290 | #define FUSE_CACHE_SYMLINKS (1 << 23) | 294 | #define FUSE_CACHE_SYMLINKS (1 << 23) |
| 291 | #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) | 295 | #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) |
| 296 | #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) | ||
| 292 | 297 | ||
| 293 | /** | 298 | /** |
| 294 | * CUSE INIT request/reply flags | 299 | * CUSE INIT request/reply flags |
