From 4b580522c11d4ab41ab9774e2ffde2516772cca9 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Wed, 1 Oct 2025 08:39:22 -0500 Subject: [PATCH] Allow setting of passthrough max_stack_depth --- libfuse/lib/debug.cpp | 16 +++++++++++++++- libfuse/lib/fuse_i.h | 1 + libfuse/lib/fuse_lowlevel.cpp | 5 +++-- src/config.hpp | 1 + 4 files changed, 20 insertions(+), 3 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..53a2dd52 100644 --- a/libfuse/lib/fuse_i.h +++ b/libfuse/lib/fuse_i.h @@ -69,6 +69,7 @@ struct fuse_ll int broken_splice_nonblock; uint64_t notify_ctr; struct fuse_notify_req notify_list; + int passthrough_max_stack_depth; }; struct fuse_cmd diff --git a/libfuse/lib/fuse_lowlevel.cpp b/libfuse/lib/fuse_lowlevel.cpp index a7a8fdca..16000cb1 100644 --- a/libfuse/lib/fuse_lowlevel.cpp +++ b/libfuse/lib/fuse_lowlevel.cpp @@ -1117,7 +1117,7 @@ do_init(fuse_req_t req, struct fuse_in_header *hdr_) { struct fuse_init_out outarg = {0}; - struct fuse_init_in *arg = (struct fuse_init_in *) &hdr_[1]; + struct fuse_init_in *arg = (struct fuse_init_in*)&hdr_[1]; struct fuse_ll *f = req->f; size_t bufsize = fuse_chan_bufsize(req->ch); uint64_t inargflags; @@ -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 + 1); } if(inargflags & FUSE_INIT_EXT) @@ -1800,6 +1800,7 @@ enum { static const struct fuse_opt fuse_ll_opts[] = { + { "passthrough-max-stack-depth=%u", offsetof(struct fuse_ll, passthrough_max_stack_depth), 0 }, { "debug", offsetof(struct fuse_ll, debug), 1 }, { "-d", offsetof(struct fuse_ll, debug), 1 }, { "max_readahead=%u", offsetof(struct fuse_ll, conn.max_readahead), 0 }, diff --git a/src/config.hpp b/src/config.hpp index ceffd157..50300b57 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -124,6 +124,7 @@ public: NFSOpenHack nfsopenhack; ConfigBOOL nullrw; Passthrough passthrough = Passthrough::ENUM::OFF; + ConfigINT passthrough_depth = 1; ConfigBOOL parallel_direct_writes; ConfigGetPid pid; ConfigBOOL posix_acl;