From 0981df62c05e71123bc14483bba347f17aafa59a Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Fri, 6 May 2022 16:16:12 +0200 Subject: [PATCH] cmsfs-fuse: fix enabling of hard_remove option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the switch to fuse3 setting the hard_remove option with the FUSE_LIB_OPT() macro is no longer supported. See libfuse commit 8ee553dac029 ("fuse_new(): don't accept options that don't make sense for end-users") for details. To fix this, add an appropriate init function which sets this option. Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/131 Fixes: e679a88d8816 ("Switch from fuse2 to fuse3") Signed-off-by: Sven Schnelle Signed-off-by: Jan Höppner --- cmsfs-fuse/cmsfs-fuse.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmsfs-fuse/cmsfs-fuse.c b/cmsfs-fuse/cmsfs-fuse.c index 4e0095fc..cfc30606 100644 --- a/cmsfs-fuse/cmsfs-fuse.c +++ b/cmsfs-fuse/cmsfs-fuse.c @@ -4492,6 +4492,15 @@ static void destroy_file_object(struct file *f) free(f); } +static void *cmsfs_oper_init(struct fuse_conn_info *conn, struct fuse_config *cfg) +{ + (void)conn; + + /* force immediate file removal */ + cfg->hard_remove = 1; + return NULL; +} + static struct file_operations fops_fixed = { .cache_data = cache_file_fixed, .write_data = extend_block_fixed, @@ -4507,6 +4516,7 @@ static struct file_operations fops_variable = { }; static struct fuse_operations cmsfs_oper = { + .init = cmsfs_oper_init, .getattr = cmsfs_getattr, .statfs = cmsfs_statfs, .readdir = cmsfs_readdir, @@ -4683,8 +4693,6 @@ int main(int argc, char *argv[]) fuse_opt_add_arg(&args, "-oro"); /* force single threaded mode which requires no locking */ fuse_opt_add_arg(&args, "-s"); - /* force immediate file removal */ - fuse_opt_add_arg(&args, "-ohard_remove"); if (cmsfs.mode == BINARY_MODE && (cmsfs.codepage_from != NULL || cmsfs.codepage_to != NULL))