From d18c2732937a420e911575baf66d080005412d44 Mon Sep 17 00:00:00 2001 From: trapexit Date: Tue, 7 Oct 2025 22:52:13 -0400 Subject: [PATCH] Allow setting of passthrough max-stack-depth (#1542) --- libfuse/lib/debug.cpp | 16 +++++++++++++++- libfuse/lib/fuse_i.h | 1 + libfuse/lib/fuse_lowlevel.cpp | 4 +++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libfuse/lib/debug.cpp b/libfuse/lib/debug.cpp index 0c8d99b5..b82bce98 100644 --- a/libfuse/lib/debug.cpp +++ b/libfuse/lib/debug.cpp @@ -861,11 +861,25 @@ fuse_syslog_fuse_init_out(const struct fuse_init_out *arg_) output = fmt::format("fuse_init_out:" " major={};" " minor={};" + " max_readahead={};" + " max_background={};" + " congestion_threshold={};" + " max_write={};" + " time_gran={};" " max_pages={};" + " map_alignment={};" + " max_stack_depth={};" " flags=(", arg_->major, arg_->minor, - arg_->max_pages); + arg_->max_readahead, + arg_->max_background, + arg_->congestion_threshold, + arg_->max_write, + arg_->time_gran, + arg_->max_pages, + arg_->map_alignment, + arg_->max_stack_depth); for(uint64_t i = 0; i < (sizeof(flags)*8); i++) { diff --git a/libfuse/lib/fuse_i.h b/libfuse/lib/fuse_i.h index e702971d..93ca59d2 100644 --- a/libfuse/lib/fuse_i.h +++ b/libfuse/lib/fuse_i.h @@ -54,6 +54,7 @@ struct fuse_notify_req struct fuse_ll { + unsigned passthrough_max_stack_depth; int debug; int no_remote_posix_lock; int no_remote_flock; diff --git a/libfuse/lib/fuse_lowlevel.cpp b/libfuse/lib/fuse_lowlevel.cpp index 4319e642..81472423 100644 --- a/libfuse/lib/fuse_lowlevel.cpp +++ b/libfuse/lib/fuse_lowlevel.cpp @@ -1288,7 +1288,7 @@ do_init(fuse_req_t req, if(f->conn.want & FUSE_CAP_PASSTHROUGH) { outargflags |= FUSE_PASSTHROUGH; - outarg.max_stack_depth = 2; + outarg.max_stack_depth = f->passthrough_max_stack_depth; } if(inargflags & FUSE_INIT_EXT) @@ -1810,6 +1810,7 @@ static const struct fuse_opt fuse_ll_opts[] = { "no_remote_lock", offsetof(struct fuse_ll, no_remote_flock), 1}, { "no_remote_flock", offsetof(struct fuse_ll, no_remote_flock), 1}, { "no_remote_posix_lock", offsetof(struct fuse_ll, no_remote_posix_lock), 1}, + { "passthrough-max-stack-depth=%u", offsetof(struct fuse_ll, passthrough_max_stack_depth), 0}, FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_DISCARD), FUSE_OPT_KEY("-h", KEY_HELP), FUSE_OPT_KEY("--help", KEY_HELP), @@ -2072,6 +2073,7 @@ fuse_lowlevel_new_common(struct fuse_args *args, f->conn.max_write = UINT_MAX; f->conn.max_readahead = UINT_MAX; + f->passthrough_max_stack_depth = 2; list_init_nreq(&f->notify_list); f->notify_ctr = 1; mutex_init(&f->lock);