From f1d880423f7d94fedddc3dd7842123275868a906 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 22 May 2024 13:31:49 +0000 Subject: [PATCH] import UBI fuse-2.9.7-19.el8 --- SOURCES/0006-BZ_2171095.patch | 2 +- ...-function-fail-if-no-kernel-support-.patch | 150 ++++++++++++++++++ ...-FUSE_CAP_PARALLEL_DIROPS-by-default.patch | 42 +++++ ...s-FUSE_PARALLEL_DIROPS-to-kernel-861.patch | 23 +++ SPECS/fuse.spec | 16 +- 5 files changed, 231 insertions(+), 2 deletions(-) create mode 100644 SOURCES/0009-Make-expire-only-function-fail-if-no-kernel-support-.patch create mode 100644 SOURCES/fuse-3.17.0-Don-t-set-FUSE_CAP_PARALLEL_DIROPS-by-default.patch create mode 100644 SOURCES/fuse-3.17.0-Pass-FUSE_PARALLEL_DIROPS-to-kernel-861.patch diff --git a/SOURCES/0006-BZ_2171095.patch b/SOURCES/0006-BZ_2171095.patch index 012f9e1..a27678f 100644 --- a/SOURCES/0006-BZ_2171095.patch +++ b/SOURCES/0006-BZ_2171095.patch @@ -111,7 +111,7 @@ index 7e50e7507..795ea4aa9 100644 FUSE_3.3 { global: fuse_open_channel; -+ fuse_lowlevel_notify_expire_entr; ++ fuse_lowlevel_notify_expire_entry; } FUSE_3.2; # Local Variables: diff --git a/SOURCES/0009-Make-expire-only-function-fail-if-no-kernel-support-.patch b/SOURCES/0009-Make-expire-only-function-fail-if-no-kernel-support-.patch new file mode 100644 index 0000000..24c53b3 --- /dev/null +++ b/SOURCES/0009-Make-expire-only-function-fail-if-no-kernel-support-.patch @@ -0,0 +1,150 @@ +From 51bc827df873d9ff4069b83796cd32fcb6bd659e Mon Sep 17 00:00:00 2001 +From: HereThereBeDragons +Date: Fri, 30 Jun 2023 14:57:06 +0200 +Subject: [PATCH] Make expire only function fail if no kernel support (#789) + +--- + include/fuse_common.h | 2 +- + include/fuse_lowlevel.h | 28 ++++++++++++++-------------- + lib/fuse_lowlevel.c | 41 ++++++++++++++++++++++++++++++++++++----- + 3 files changed, 51 insertions(+), 20 deletions(-) + +--- a/include/fuse_common.h ++++ b/include/fuse_common.h +@@ -338,7 +338,7 @@ struct fuse_loop_config { + #define FUSE_CAP_CACHE_SYMLINKS (1 << 23) + + /** +- * Indicates support that dentries can be expired or invalidated. ++ * Indicates support that dentries can be expired. + * + * Expiring dentries, instead of invalidating them, makes a difference for + * overmounted dentries, where plain invalidation would detach all submounts +--- a/include/fuse_lowlevel.h ++++ b/include/fuse_lowlevel.h +@@ -131,11 +131,12 @@ struct fuse_forget_data { + }; + + /** +- * Flags for fuse_lowlevel_notify_expire_entry() ++ * Flags for fuse_lowlevel_notify_entry() + * 0 = invalidate entry + * FUSE_LL_EXPIRE_ONLY = expire entry + */ +-enum fuse_expire_flags { ++enum fuse_notify_entry_flags { ++ FUSE_LL_INVALIDATE = 0, + FUSE_LL_EXPIRE_ONLY = (1 << 0), + }; + +@@ -1560,8 +1561,7 @@ int fuse_lowlevel_notify_inval_inode(str + off_t off, off_t len); + + /** +- * Notify to invalidate parent attributes and the dentry matching +- * parent/name ++ * Notify to invalidate parent attributes and the dentry matching parent/name + * + * To avoid a deadlock this function must not be called while + * executing a related filesytem operation or while holding a lock +@@ -1588,14 +1588,13 @@ int fuse_lowlevel_notify_inval_entry(str + const char *name, size_t namelen); + + /** +- * Notify to expire or invalidate parent attributes and the dentry +- * matching parent/name ++ * Notify to expire parent attributes and the dentry matching parent/name + * +- * Underlying function for fuse_lowlevel_notify_inval_entry(). ++ * Same restrictions apply as for fuse_lowlevel_notify_inval_entry() + * +- * In addition to invalidating an entry, it also allows to expire an entry. +- * In that case, the entry is not forcefully removed from kernel cache +- * but instead the next access to it forces a lookup from the filesystem. ++ * Compared to invalidating an entry, expiring the entry results not in a ++ * forceful removal of that entry from kernel cache but instead the next access ++ * to it forces a lookup from the filesystem. + * + * This makes a difference for overmounted dentries, where plain invalidation + * would detach all submounts before dropping the dentry from the cache. +@@ -1606,17 +1605,18 @@ int fuse_lowlevel_notify_inval_entry(str + * so invalidation will only be triggered for the non-overmounted case. + * The dentry could also be mounted in a different mount instance, in which case + * any submounts will still be detached. ++ * ++ * Added in FUSE protocol version 7.38. If the kernel does not support ++ * this (or a newer) version, the function will return -ENOSYS and do nothing. + * + * @param se the session object + * @param parent inode number + * @param name file name + * @param namelen strlen() of file name +- * @param flags flags to control if the entry should be expired or invalidated +- * @return zero for success, -errno for failure ++ * @return zero for success, -errno for failure, -enosys if no kernel support + */ + int fuse_lowlevel_notify_expire_entry(struct fuse_session *se, fuse_ino_t parent, +- const char *name, size_t namelen, +- enum fuse_expire_flags flags); ++ const char *name, size_t namelen); + + /** + * This function behaves like fuse_lowlevel_notify_inval_entry() with +--- a/lib/fuse_lowlevel.c ++++ b/lib/fuse_lowlevel.c +@@ -2172,9 +2172,28 @@ int fuse_lowlevel_notify_inval_inode(str + return send_notify_iov(se, FUSE_NOTIFY_INVAL_INODE, iov, 2); + } + +-int fuse_lowlevel_notify_expire_entry(struct fuse_session *se, fuse_ino_t parent, +- const char *name, size_t namelen, +- enum fuse_expire_flags flags) ++/** ++ * Notify parent attributes and the dentry matching parent/name ++ * ++ * Underlying base function for fuse_lowlevel_notify_inval_entry() and ++ * fuse_lowlevel_notify_expire_entry(). ++ * ++ * @warning ++ * Only checks if fuse_lowlevel_notify_inval_entry() is supported by ++ * the kernel. All other flags will fall back to ++ * fuse_lowlevel_notify_inval_entry() if not supported! ++ * DO THE PROPER CHECKS IN THE DERIVED FUNCTION! ++ * ++ * @param se the session object ++ * @param parent inode number ++ * @param name file name ++ * @param namelen strlen() of file name ++ * @param flags flags to control if the entry should be expired or invalidated ++ * @return zero for success, -errno for failure ++*/ ++static int fuse_lowlevel_notify_entry(struct fuse_session *se, fuse_ino_t parent, ++ const char *name, size_t namelen, ++ enum fuse_notify_entry_flags flags) + { + struct fuse_notify_inval_entry_out outarg; + struct iovec iov[3]; +@@ -2200,9 +2219,21 @@ int fuse_lowlevel_notify_expire_entry(st + } + + int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent, +- const char *name, size_t namelen) ++ const char *name, size_t namelen) ++{ ++ return fuse_lowlevel_notify_entry(se, parent, name, namelen, FUSE_LL_INVALIDATE); ++} ++ ++int fuse_lowlevel_notify_expire_entry(struct fuse_session *se, fuse_ino_t parent, ++ const char *name, size_t namelen) + { +- return fuse_lowlevel_notify_expire_entry(se, parent, name, namelen, 0); ++ if (!se) ++ return -EINVAL; ++ ++ if (!(se->conn.capable & FUSE_CAP_EXPIRE_ONLY)) ++ return -ENOSYS; ++ ++ return fuse_lowlevel_notify_entry(se, parent, name, namelen, FUSE_LL_EXPIRE_ONLY); + } + + diff --git a/SOURCES/fuse-3.17.0-Don-t-set-FUSE_CAP_PARALLEL_DIROPS-by-default.patch b/SOURCES/fuse-3.17.0-Don-t-set-FUSE_CAP_PARALLEL_DIROPS-by-default.patch new file mode 100644 index 0000000..f2a7e54 --- /dev/null +++ b/SOURCES/fuse-3.17.0-Don-t-set-FUSE_CAP_PARALLEL_DIROPS-by-default.patch @@ -0,0 +1,42 @@ +From 2c736f516f28dfb5c58aff345c668a5ea6386295 Mon Sep 17 00:00:00 2001 +From: Miklos Szeredi +Date: Wed, 10 Jan 2024 10:15:43 +0100 +Subject: [PATCH] Don't set FUSE_CAP_PARALLEL_DIROPS by default + +Allowing parallel dir operations could result in a crash in a filesystem +implementation that is not prepared for this. + +To be safe keep this flag off by default (this is not a regression, since +there was no public release where this flag wasn't ignored). + +If the filesystem wants better performance, then it should set this flag +explicitly. + +Fixes: c9905341ea34 ("Pass FUSE_PARALLEL_DIROPS to kernel (#861)") +Signed-off-by: Miklos Szeredi +--- + include/fuse_common.h | 2 -- + lib/fuse_lowlevel.c | 1 - + 2 files changed, 3 deletions(-) + +--- a/include/fuse_common.h ++++ b/include/fuse_common.h +@@ -313,8 +313,6 @@ struct fuse_loop_config { + * is unset, the FUSE kernel module will ensure that lookup() and + * readdir() requests are never issued concurrently for the same + * directory. +- * +- * This feature is enabled by default when supported by the kernel. + */ + #define FUSE_CAP_PARALLEL_DIROPS (1 << 18) + +--- a/lib/fuse_lowlevel.c ++++ b/lib/fuse_lowlevel.c +@@ -2009,7 +2009,6 @@ void do_init(fuse_req_t req, fuse_ino_t + if ((cond) && (se->conn.capable & (cap))) \ + se->conn.want |= (cap) + LL_SET_DEFAULT(1, FUSE_CAP_ASYNC_READ); +- LL_SET_DEFAULT(1, FUSE_CAP_PARALLEL_DIROPS); + LL_SET_DEFAULT(1, FUSE_CAP_AUTO_INVAL_DATA); + LL_SET_DEFAULT(1, FUSE_CAP_HANDLE_KILLPRIV); + LL_SET_DEFAULT(1, FUSE_CAP_ASYNC_DIO); diff --git a/SOURCES/fuse-3.17.0-Pass-FUSE_PARALLEL_DIROPS-to-kernel-861.patch b/SOURCES/fuse-3.17.0-Pass-FUSE_PARALLEL_DIROPS-to-kernel-861.patch new file mode 100644 index 0000000..4e4420a --- /dev/null +++ b/SOURCES/fuse-3.17.0-Pass-FUSE_PARALLEL_DIROPS-to-kernel-861.patch @@ -0,0 +1,23 @@ +From c9905341ea34ff9acbc11b3c53ba8bcea35eeed8 Mon Sep 17 00:00:00 2001 +From: fdinoff +Date: Thu, 16 Nov 2023 06:23:20 -0500 +Subject: [PATCH] Pass FUSE_PARALLEL_DIROPS to kernel (#861) + +This tells the kernel that parallel lookup/readdir operations are +supported. This is enabled by default but was not passed to the kernel +so you always get the synchronized version. +--- + lib/fuse_lowlevel.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/lib/fuse_lowlevel.c ++++ b/lib/fuse_lowlevel.c +@@ -2093,6 +2093,8 @@ void do_init(fuse_req_t req, fuse_ino_t + outargflags |= FUSE_ASYNC_DIO; + if (se->conn.want & FUSE_CAP_WRITEBACK_CACHE) + outargflags |= FUSE_WRITEBACK_CACHE; ++ if (se->conn.want & FUSE_CAP_PARALLEL_DIROPS) ++ outargflags |= FUSE_PARALLEL_DIROPS; + if (se->conn.want & FUSE_CAP_POSIX_ACL) + outargflags |= FUSE_POSIX_ACL; + if (se->conn.want & FUSE_CAP_CACHE_SYMLINKS) diff --git a/SPECS/fuse.spec b/SPECS/fuse.spec index dc9b0d0..760fa07 100644 --- a/SPECS/fuse.spec +++ b/SPECS/fuse.spec @@ -4,7 +4,7 @@ Name: fuse Version: %{fuse2ver} -Release: 17%{?dist} +Release: 19%{?dist} Summary: File System in Userspace (FUSE) v2 utilities License: GPL+ URL: http://fuse.sf.net @@ -30,6 +30,9 @@ Patch12: 0005-BZ_217095_Modify-structures-in-libfuse-to-handle-flags-beyond-rhel Patch13: 0006-BZ_2171095.patch Patch14: 0007-BZ_2171095-cap.patch Patch15: 0008-BZ_217095-libfuse-add-feature-flag-for-expire-only.patch +Patch16: fuse-3.17.0-Pass-FUSE_PARALLEL_DIROPS-to-kernel-861.patch +Patch17: fuse-3.17.0-Don-t-set-FUSE_CAP_PARALLEL_DIROPS-by-default.patch +Patch18: 0009-Make-expire-only-function-fail-if-no-kernel-support-.patch Requires: which Conflicts: filesystem < 3 @@ -128,6 +131,9 @@ pushd lib%{name}-%{name}-%{fuse3ver} %patch13 -p1 %patch14 -p1 %patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 popd @@ -259,6 +265,14 @@ rm -f %{buildroot}/usr/lib/udev/rules.d/99-fuse3.rules %{_includedir}/fuse3/ %changelog +* Tue Feb 06 2024 Pavel Reichl - 2.9.7-19 +- Synchronize expire-only API with upstream. +- Related: RHEL-23415 + +* Fri Feb 02 2024 Pavel Reichl - 2.9.7-18 +- Advertise support of FUSE_PARALLEL_DIROPS to kernel +- Fixes RHEL-19149 + * Thu Mar 23 2023 Pavel Reichl - 2.9.7-17 - Add feature_notify_inode_expire_only - Fixes rhbz#2171095