mergerfs/vendored/libfuse/include
Antonio S. Musumeci 9d12bcf235 Return ENOENT, not EBADF, for removed nodes with no open file
Once a file or directory is removed (unlink, rmdir, rename over it)
libfuse has no path for its node and falls back to the fh based
getattr/setattr/statx with fh=0. If mergerfs had no open file for the
node (a directory, an O_PATH fd, a cwd, or a dentry resolved just
before the removal) it returned EBADF. The kernel sends GETATTR for
such nodes in the permission checks of a path walk, so lstat() of a
directory, or of a path below it, could fail with EBADF while rm -rf
removed it. Two rm -rf at once, one on a directory and one on the
directory above it, met it when one removed a directory the other
still had open: the other's unlinkat() through its dirfd failed, rm
reported "Bad file descriptor" and left entries behind.

mergerfs now returns ENOENT. That is what a local filesystem gives
*at() calls in a removed directory, and what rm -f ignores. ESTALE
would make the kernel redo a path based lookup, which helps a stat
racing a rename over the path. But a call through a dirfd or cwd of a
removed directory meets the same node again and fails anyway, and the
concurrent rm -rf still did. Calls on the removed object itself, which
succeed on a local filesystem, get ENOENT instead of EBADF.

TEST_rm_rf_concurrent runs the two cases reported. The rm -rf one is
a narrow race; TEST_use_dirfd_after_rmdir covers its cause without
one, with cache.attr=0 so the kernel sends GETATTR every time.

See #1693.
2026-11-17 12:25:50 -06:00
..
base_types.h Add support for FUSE_COPY_FILE_RANGE_64 2026-04-01 23:20:05 -05:00
bounded_queue.hpp Misc fixes and improvements to thread pool 2026-03-24 21:13:34 -04:00
debug.hpp Rework readlink to not depend on cstr nul termination 2026-04-26 01:37:08 -04:00
extern_c.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fatal.hpp Use fatal::abort() rather than assert in places 2026-03-24 21:13:34 -04:00
fs_dirent64.hpp Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse.h Return ENOENT, not EBADF, for removed nodes with no open file 2026-11-17 12:25:50 -06:00
fuse_attr.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_cfg.hpp Use shared_mutex for fuse log config 2026-05-14 00:22:06 -04:00
fuse_common.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_conn_info.hpp Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_dirent.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_direntplus.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_dirents.hpp Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_entry.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_kernel.h Add support for FUSE_COPY_FILE_RANGE_64 2026-04-01 23:20:05 -05:00
fuse_lowlevel.h Remove unused lock operation plumbing 2026-05-06 20:49:46 -04:00
fuse_msgbuf.hpp Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_msgbuf_t.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_opt.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_pollhandle.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_req.hpp Manage cloned /dev/fuse fds in sessions 2026-05-14 20:13:07 -05:00
fuse_req_ctx.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
fuse_timeouts.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
invocable.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
kvec.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
maintenance_thread.hpp Move maintainence thread func take u64 rather than int 2026-03-24 21:13:34 -04:00
mutex.hpp Move scope_guard to vendored/ 2026-03-24 21:13:34 -04:00
mutex_debug.hpp Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
mutex_ndebug.hpp Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
objpool.hpp libfuse: thread_pool/objpool/fuse_loop - safer memory and iteration 2026-04-18 13:47:23 -05:00
stat_utils.h Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
syslog.hpp Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
thread_pool.hpp libfuse: thread_pool/objpool/fuse_loop - safer memory and iteration 2026-04-18 13:47:23 -05:00