mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-25 01:16:30 -05:00
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. |
||
|---|---|---|
| .. | ||
| base_types.h | ||
| bounded_queue.hpp | ||
| debug.hpp | ||
| extern_c.h | ||
| fatal.hpp | ||
| fs_dirent64.hpp | ||
| fuse.h | ||
| fuse_attr.h | ||
| fuse_cfg.hpp | ||
| fuse_common.h | ||
| fuse_conn_info.hpp | ||
| fuse_dirent.h | ||
| fuse_direntplus.h | ||
| fuse_dirents.hpp | ||
| fuse_entry.h | ||
| fuse_kernel.h | ||
| fuse_lowlevel.h | ||
| fuse_msgbuf.hpp | ||
| fuse_msgbuf_t.h | ||
| fuse_opt.h | ||
| fuse_pollhandle.h | ||
| fuse_req.hpp | ||
| fuse_req_ctx.h | ||
| fuse_timeouts.h | ||
| invocable.h | ||
| kvec.h | ||
| maintenance_thread.hpp | ||
| mutex.hpp | ||
| mutex_debug.hpp | ||
| mutex_ndebug.hpp | ||
| objpool.hpp | ||
| stat_utils.h | ||
| syslog.hpp | ||
| thread_pool.hpp | ||