diff options
author | Bernd Schubert <bernd@bsbernd.com> | 2025-09-22 10:46:46 +0200 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-09-22 13:48:33 +0200 |
commit | 59cf26a2d778b88819db528c67141b788a8b48a1 (patch) | |
tree | c179339f1af79d6b5eff6e5de69e452ac000ee25 | |
parent | 30bf3c86a933887407da901a05d726cebf6c5793 (diff) | |
download | libfuse-59cf26a2d778b88819db528c67141b788a8b48a1.tar.gz |
FUSE_INIT handler: Set got_init only shortly before send_reply_ok
A previous commit added single thread behavior as long as se->got_init is
not set, especially as buffer allocation should be done after got_init
only. Technically it should not make a difference in current libfuse
design, as more worker threads are only allocated after the FUSE_INIT
handler is completely done. That might at some point change, though.
In general it is cleaner to set se->got_init, when the init handler
is done.
Done as separate commit, as this introduces a slight risk to break
something - backport to older version should be done carefully.
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
-rw-r--r-- | lib/fuse_lowlevel.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index cacab94..a1a1427 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2799,7 +2799,6 @@ _do_init(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in, se->conn.time_gran = 1; - se->got_init = 1; if (se->op.init) { // Apply the first 32 bits of capable_ext to capable se->conn.capable = fuse_lower_32_bits(se->conn.capable_ext); @@ -2970,6 +2969,13 @@ _do_init(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in, } } + /* + * Has to be set before replying, as new kernel requests might + * immediately arrive and got_init is used for op-code sanity. + * Especially with external handlers, where we have no control + * over the thread scheduling. + */ + se->got_init = 1; send_reply_ok(req, &outarg, outargsize); if (enable_io_uring) fuse_uring_wake_ring_threads(se); |