| | |
|---|---|
| base of every series | `9d01fb77f46e` (`v7.1-102-g9d01fb77`), upstream btrfs-progs `devel` as of 2026-10-29: `testing^1` |
-| integration branch | `testing` `14c065a7fff1` (octopus of the base and the 6 topics; `scrub-progress-socket` contains `scrub-limit-only-with-option`, which is also a parent, as on the kernel lanes) |
+| integration branch | `testing` `a32d935104d8` (octopus of the base and the 6 topics; `scrub-progress-socket` contains `scrub-limit-only-with-option`, which is also a parent, as on the kernel lanes) |
| upstream `devel` now | `55f4cfb9c932` (one docs-only commit past the base; the lane has not been rebased onto it) |
Unlike the kernel lane's base, this base is a published upstream commit,
| `mkfs-remap-tree` | 1 | | Zygo | `mkfs.btrfs -O remap-tree` (experimental builds) segfaults in `write_ctree_super()` without it |
| `dump-tree-replace-stop-time` | 1 | | Zygo | dump-tree printed the dev-replace start time as the stop time |
| `replace-abort-uncorrectable` | 1 | | Zygo | `btrfs replace start --abort-on-uncorrectable`; the user space half of the kernel patch "btrfs: dev-replace: optionally abort on uncorrectable read errors" (kernel export `~/share/linux-upstream/topics/replace-fixes/`). Send with or after the kernel series: the flag value is defined there |
-| `logical-resolve-fixes` | 4 | | Zygo | Issue #400; patch 3 fixes inode-resolve paths below the subvolume root; patch 4 changes the exit status and moves a message to stderr, and updates misc-tests/042; hex addresses (defect 6) left out on purpose |
+| `logical-resolve-fixes` | 4 | | Zygo | Issue #400; patch 2 also resolves through bind mounts of directories; patch 3 fixes inode-resolve paths below the subvolume root (new misc-tests/074); patch 4 changes the exit status and moves a message to stderr, and updates misc-tests/042; hex addresses (defect 6) left out on purpose |
| `scrub-limit-only-with-option` | 2 | | Zygo | follows up 01c8277d (Issue #1165) |
| `scrub-progress-socket` | 2 | `scrub-limit-only-with-option` | Zygo | both change the parent's branch after the fork in `scrub_start()`; patch 2 includes the combined code |
BTRFS_ASSERT). Evidence: raid56-wh-harness
`forensics/progs-testsuite-20261030/SUMMARY.md` (harness b243013).
-3bc81a49 differs from the current `testing` 14c065a7 in four ways,
+3bc81a49 differs from the current `testing` a32d9351 in four ways,
all in logical-resolve-fixes: it still had the arg_strtou64() hex patch
that was since dropped, and the collapsed misc-tests/042 line that was
since restored; and it predates the fix for a path argument inside a
subvolume (e.g. a bind-mounted directory) and the bind mount cases of
-misc-tests/042 (2026-10-30); and it predates the inode-resolve patch.
+misc-tests/042 (2026-10-30); and it predates the inode-resolve patch, misc-tests/074 and the bind mount route.
| suite | pass | not run | fail |
|---|---|---|---|
-From da97c420ee4aeebef7f405b7dd45ad47865d33b8 Mon Sep 17 00:00:00 2001
+From bed8b5eb14d775f96649a15b19da6ba5d3f816b7 Mon Sep 17 00:00:00 2001
From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Fri, 30 Oct 2026 17:30:53 -0400
+Date: Fri, 30 Oct 2026 18:58:57 -0400
Subject: [PATCH 0/4] btrfs-progs: inspect logical-resolve: find the file names again
To: linux-btrfs@vger.kernel.org
Patch 1 fixes 1: skip optional fields up to the lone "-".
-Patch 2 fixes 2 to 5. For each reference, open the subvolume below the
-path argument if it is there (and print paths relative to the argument
-as given, so "." gives "./subvol/file"). If the argument is itself a
-directory inside that subvolume, for example a bind mount of a
-directory or a directory in one, print the inode's paths that are below
-the argument, relative to it. Otherwise go through the mount of its
-deepest mounted ancestor or of itself. Every subvolume opened is
-checked to be the root of that subvolume (inode 256, root id) on the
-same filesystem (fsid) before INO_PATHS is called on it, and an
-argument inside the subvolume must have its root id. That check also
-covers the bind mount case the mountinfo lookup was introduced for: a
-bind mount of a directory inside a subvolume is not taken as the mount
-of that subvolume.
+Patch 2 fixes 2 to 5. The paths of each reference are printed through
+the first of these routes that reaches them:
+1. below the path argument, when the subvolume is there (paths relative
+ to the argument as given, so "." gives "./subvol/file");
+2. inside the argument, when the argument is a directory of that
+ subvolume below its root, for example a bind mount of a directory:
+ the paths below the argument, relative to it;
+3. the mount of the subvolume's deepest mounted ancestor or of itself
+ (longest mounted path; the first in mountinfo order among equals);
+4. a mount of a directory inside the subvolume (a bind mount), for the
+ paths below that directory: the one closest to the subvolume root,
+ the first in mountinfo order among equals.
+Routes 1 and 3 reach every path of the inode, routes 2 and 4 only some,
+so the routes apply per path: a hard link outside a bind mounted
+argument is printed through another mount. A path that no route
+reaches is reported as "inode N subvol S path P could not be accessed:
+not mounted". Every directory opened is checked: in routes 1 and 3 to
+be the root of that subvolume (inode 256, root id), in routes 2 and 4 to
+be in it (root id), on the same filesystem (fsid). Route 4 finds the
+bound directory's place from its inode (INO_LOOKUP), not from the
+mountinfo text, so a renamed directory is followed, and it skips a
+deleted one (link count 0): until the transaction commits, INO_LOOKUP
+still returns a deleted directory's old path, which may be another
+directory's by then. The check also covers the bind mount case the
+mountinfo lookup was introduced for: a bind mount of a directory inside
+a subvolume is never taken as the mount of the whole subvolume.
find_mount_fsroot() and find_option() lose their only user and are
replaced by iterate_btrfs_mounts().
-Patch 3 fixes 7 with the same rule as patch 2 uses for an argument
-inside the subvolume: print the inode's paths below the argument,
-relative to it. Paths of other hard links outside the argument cannot
-be printed relative to it; they are counted and reported on stderr, with
-exit status 1. With the subvolume root as the argument nothing changes.
-It adds inode-resolve cases to misc-tests/042 (there is no inode-resolve
-test): a directory inside the subvolume, ".", a bind mount of a
-directory, and a second hard link outside the argument. It is a patch
-of its own because it fixes a different command and an older commit,
-but it reuses the helpers of patch 2, so it comes after it.
+Patch 3 fixes 7 the same way: with a directory inside the subvolume as
+the argument, inode-resolve resolves the inode's paths through the
+routes of patch 2 (2, 3, 4), so the paths below the argument are
+printed relative to it and other hard links through the mounts. With
+the subvolume root as the argument nothing changes. It adds
+misc-tests/074-inspect-internal-inode-resolve. It is a patch of its
+own because it fixes a different command and an older commit, but it
+uses the resolver of patch 2, so it comes after it.
-Patch 4 reports a reference whose subvolume cannot be reached at all as
+Patch 4 reports a reference, or a path of one, that no route reaches as
an error on stderr and exits with status 1, after printing all the other
paths. Today the message goes to stdout with status 0, so a script sees
fewer paths, or none, and no error. It updates misc-tests/042, which
requires the error whenever the status is 1. This test is also why CI
never caught defect 3: it counted a "could not be accessed" line as a
pass. The patch also adds cases to 042 where bind mounts of
-directories are the only way in, and checks that the expected path
-relative to the argument is printed.
+directories are the only way in, and checks that the expected path is
+printed, and updates 074 for the new message and exit status.
User-visible changes:
- Patch 2: paths are printed relative to the path argument when the
subvolume is below it, which changes the output even of setups that
work today: with the top level at /mnt and subvol=/sv1 also mounted at
/mnt2, sv1's file is printed as /mnt/sv1/f1 (was /mnt2/f1) when /mnt
- is the argument. The mount point route is used only for subvolumes
- outside the argument.
+ is the argument. The mount routes are used only for subvolumes, or
+ paths, outside the argument.
- Patch 3: inode-resolve with a directory inside the subvolume as the
- argument prints existing paths relative to it (was argument + path
- from the subvolume root), and exits with status 1 when some of the
- inode's names are outside the argument.
-- Patch 4: the "could not be accessed" message moves from stdout to
+ argument prints existing paths, relative to it (was argument + path
+ from the subvolume root); hard links outside it come through the
+ mounts, or are reported as not mounted.
+- Patch 4: the "could not be accessed" messages move from stdout to
stderr, and the exit status becomes 1. This patch is separable; the
others do not depend on it.
Patch 2 depends on patch 1 only for mounts in namespaces whose
-propagation is not exactly one optional field; patch 3 uses helpers
-that patch 2 adds; patch 4 changes the message that patch 2 leaves in
-place. Apply in order.
+propagation is not exactly one optional field; patch 3 uses the
+resolver that patch 2 adds; patch 4 changes the messages that patch 2
+prints. Apply in order.
Link: https://github.com/kdave/btrfs-progs/issues/400
btrfs-progs: inspect logical-resolve: fail on an unresolvable
reference
- cmds/inspect.c | 399 +++++++++++++++---
- common/utils.c | 135 ++----
+ cmds/inspect.c | 564 +++++++++++++++---
+ common/utils.c | 135 ++---
common/utils.h | 3 +-
- .../test.sh | 160 ++++++-
- 4 files changed, 523 insertions(+), 174 deletions(-)
+ .../test.sh | 104 +++-
+ .../test.sh | 93 +++
+ 5 files changed, 707 insertions(+), 192 deletions(-)
+ create mode 100755 tests/misc-tests/074-inspect-internal-inode-resolve/test.sh
base-commit: 9d01fb77f46e98047df6767e237718b5ed816558
-From 2147f7bb001f3c244788ebd6ea4c03cdf3e00b23 Mon Sep 17 00:00:00 2001
+From 0d145ccc99125895c7de885a2bd80b4d5073c063 Mon Sep 17 00:00:00 2001
From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Date: Thu, 29 Oct 2026 23:34:26 -0400
Subject: [PATCH 2/4] btrfs-progs: inspect logical-resolve: find subvolumes
resolves the inode number in the wrong subvolume, and prints a wrong
name or fails with "ino paths ioctl: No such file or directory".
-Resolve the subvolume of each reference like this:
+Resolve the paths of each reference through the first of these routes
+that reaches them:
1. Below the path argument: if the subvolume's path in the filesystem
is below the path of the argument, open it relative to the argument,
are below the argument, relative to it. The argument must be in the
subvolume (same root id; same filesystem by definition).
-3. Otherwise, or when no path of the inode is below the argument,
- through the mount of its deepest ancestor (or of itself): among btrfs
- mounts whose mounted path is the subvolume's path or a prefix of it
- at a path component boundary, the longest one that leads to the
- subvolume.
+3. The mount of its deepest ancestor (or of itself): among btrfs mounts
+ whose mounted path is the subvolume's path or a prefix of it at a
+ path component boundary, the longest one that leads to the
+ subvolume, the first in mountinfo order among equals.
-In cases 1 and 3 the opened directory is checked to be the root of that
+4. The mount of a directory inside the subvolume (a bind mount of a
+ directory), for the paths below that directory: the mount whose
+ directory is closest to the subvolume root, the first in mountinfo
+ order among equals. The mount must be in the subvolume (root id) on
+ the same filesystem (fsid), and the directory's place in the
+ subvolume is found from its inode with INO_LOOKUP, not from the
+ mountinfo text, so a renamed directory is found where it is now. A
+ deleted directory (link count 0) is skipped: until the transaction
+ commits INO_LOOKUP still returns its old path, which can be another
+ directory's by then.
+
+Routes 1 and 3 reach every path of the inode; routes 2 and 4 only the
+paths below their directory, so for those the routes apply to each path
+(a hard link outside a bind mounted directory is printed through
+another mount when there is one). A path that no route reaches is
+reported as
+
+ inode 257 subvol sv1 path dir/file could not be accessed: not mounted
+
+and a reference whose subvolume no route reaches at all as before.
+
+In routes 1 and 3 the opened directory is checked to be the root of that
subvolume (inode 256, INO_LOOKUP root id) on the same filesystem (fsid
from FS_INFO) before INO_PATHS is called on it. That check also takes
care of the bind mount case that the mountinfo lookup was introduced
for: a bind mount of a directory inside a subvolume does not have the
-subvolume's path as its mounted path, so it is not an ancestor.
+subvolume's path as its mounted path, so it is not taken as the mount of
+the subvolume; it is used by route 4 for the paths below it only.
find_mount_fsroot() and find_option() lose their only user; replace
them with iterate_btrfs_mounts(), which reports every btrfs mount and
Fixes: 6055e736045d ("Btrfs-progs: added ioctls and commands to resolve inodes and logical addrs")
Assisted-by: Claude:claude-opus-5-5
---
- cmds/inspect.c | 349 +++++++++++++++++++++++++++++++++++++++----------
- common/utils.c | 115 +++-------------
+ cmds/inspect.c | 522 +++++++++++++++++++++++++++++++++++++++++--------
+ common/utils.c | 115 ++---------
common/utils.h | 3 +-
- 3 files changed, 303 insertions(+), 164 deletions(-)
+ 3 files changed, 459 insertions(+), 181 deletions(-)
diff --git a/cmds/inspect.c b/cmds/inspect.c
-index 35a51e42..8f12c6ed 100644
+index 35a51e42..baa3d6e4 100644
--- a/cmds/inspect.c
+++ b/cmds/inspect.c
-@@ -55,7 +55,14 @@ static const char * const inspect_cmd_group_usage[] = {
+@@ -55,12 +55,15 @@ static const char * const inspect_cmd_group_usage[] = {
NULL
};
-static int __ino_to_path_fd(u64 inum, int fd, const char *prepend)
+/*
-+ * Print the paths of inode @inum in the subvolume of @fd, each after
-+ * @prepend. If @strip is set, print only the paths below the directory
-+ * @strip (relative to the subvolume root), without that part, and count
-+ * them in @printed.
++ * Read the paths of inode @inum in the subvolume of @fd, relative to the
++ * subvolume root, into @pathbuf of PATH_MAX bytes. Return 0 or 1 (error
++ * printed).
+ */
-+static int ino_to_path_fd_below(u64 inum, int fd, const char *prepend,
-+ const char *strip, int *printed)
++static int ino_paths(u64 inum, int fd, char *pathbuf)
{
int ret;
- int i;
-@@ -85,6 +92,15 @@ static int __ino_to_path_fd(u64 inum, int fd, const char *prepend)
- ptr = (u64)(unsigned long)fspath->val;
- ptr += fspath->val[i];
- str = (char *)(unsigned long)ptr;
-+ if (strip) {
-+ size_t len = strlen(strip);
-+
-+ if (strncmp(str, strip, len) != 0 || str[len] != '/')
-+ continue;
-+ str += len + 1;
-+ }
-+ if (printed)
-+ (*printed)++;
- if (prepend)
- pr_default("%s/%s\n", prepend, str);
- else
-@@ -95,6 +111,11 @@ out:
- return !!ret;
- }
+- int i;
+ struct btrfs_ioctl_ino_path_args ipa;
+- char pathbuf[PATH_MAX];
+ struct btrfs_data_container *fspath = (struct btrfs_data_container *)pathbuf;
-+static int __ino_to_path_fd(u64 inum, int fd, const char *prepend)
+ memset(fspath, 0, sizeof(*fspath));
+@@ -71,28 +74,45 @@ static int __ino_to_path_fd(u64 inum, int fd, const char *prepend)
+ ret = ioctl(fd, BTRFS_IOC_INO_PATHS, &ipa);
+ if (ret < 0) {
+ error("ino paths ioctl: %m");
+- goto out;
++ return 1;
+ }
+
+ pr_debug("ioctl ret=%d, bytes_left=%lu, bytes_missing=%lu cnt=%d, missed=%d\n",
+ ret, (unsigned long)fspath->bytes_left,
+ (unsigned long)fspath->bytes_missing, fspath->elem_cnt,
+ fspath->elem_missed);
++ return 0;
++}
+
+- for (i = 0; i < fspath->elem_cnt; ++i) {
+- u64 ptr;
+- char *str;
+- ptr = (u64)(unsigned long)fspath->val;
+- ptr += fspath->val[i];
+- str = (char *)(unsigned long)ptr;
+- if (prepend)
+- pr_default("%s/%s\n", prepend, str);
+- else
+- pr_default("%s\n", str);
+- }
++static const char *ino_path(const char *pathbuf, int i)
+{
-+ return ino_to_path_fd_below(inum, fd, prepend, NULL, NULL);
++ const struct btrfs_data_container *fspath = (const void *)pathbuf;
++ u64 ptr;
+
+-out:
+- return !!ret;
++ ptr = (u64)(unsigned long)fspath->val;
++ ptr += fspath->val[i];
++ return (const char *)(unsigned long)ptr;
+}
+
++static void print_ino_path(const char *prepend, const char *str)
++{
++ if (prepend)
++ pr_default("%s/%s\n", prepend, str);
++ else
++ pr_default("%s\n", str);
++}
++
++static int __ino_to_path_fd(u64 inum, int fd, const char *prepend)
++{
++ char pathbuf[PATH_MAX];
++ const struct btrfs_data_container *fspath = (const void *)pathbuf;
++ int i;
++
++ if (ino_paths(inum, fd, pathbuf))
++ return 1;
++ for (i = 0; i < fspath->elem_cnt; ++i)
++ print_ino_path(prepend, ino_path(pathbuf, i));
++ return 0;
+ }
+
static const char * const cmd_inspect_inode_resolve_usage[] = {
- "btrfs inspect-internal inode-resolve [-v] <inode> <path>",
- "Get file system paths for the given inode",
-@@ -140,6 +161,212 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
+@@ -140,6 +160,379 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
}
static DEFINE_SIMPLE_COMMAND(inspect_inode_resolve, "inode-resolve");
+}
+
+/*
-+ * Path of the directory open at @fd relative to the top level subvolume of
-+ * its filesystem, without leading or trailing slash ("" for the top level).
++ * Path of the directory open at @fd relative to the root of its subvolume,
++ * found from its inode, without leading or trailing slash ("" for the
++ * subvolume root). Fails for a directory that has been deleted: until the
++ * transaction commits, INO_LOOKUP still returns its old path, which may be
++ * another directory's now.
+ */
-+static int fs_path_of_fd(int fd, char *buf, size_t size)
++static int subvol_path_of_fd(int fd, char *buf, size_t size)
+{
+ struct btrfs_ioctl_ino_lookup_args args = { 0 };
+ struct stat st;
-+ u64 rootid;
+ size_t len;
-+ int ret;
+
-+ ret = lookup_path_rootid(fd, &rootid);
-+ if (ret < 0)
-+ return ret;
-+ ret = btrfs_subvolid_resolve(fd, buf, size, rootid);
-+ if (ret < 0)
-+ return ret;
++ buf[0] = 0;
+ if (fstat(fd, &st) < 0)
+ return -errno;
++ if (st.st_nlink == 0)
++ return -ENOENT;
+ if (st.st_ino == BTRFS_FIRST_FREE_OBJECTID)
+ return 0;
+
-+ /* A directory inside the subvolume, its path ends with a slash */
-+ args.treeid = rootid;
++ /* treeid 0 is the subvolume of @fd, the path ends with a slash */
+ args.objectid = st.st_ino;
+ if (ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args) < 0)
+ return -errno;
+ len = strlen(args.name);
+ if (len && args.name[len - 1] == '/')
+ args.name[--len] = 0;
-+ if (strlen(buf) + 1 + len + 1 > size)
++ if (len + 1 > size)
++ return -EOVERFLOW;
++ memcpy(buf, args.name, len + 1);
++ return 0;
++}
++
++/*
++ * Path of the directory open at @fd relative to the top level subvolume of
++ * its filesystem, without leading or trailing slash ("" for the top level).
++ */
++static int fs_path_of_fd(int fd, char *buf, size_t size)
++{
++ char rel[PATH_MAX];
++ u64 rootid;
++ int ret;
++
++ ret = lookup_path_rootid(fd, &rootid);
++ if (ret < 0)
++ return ret;
++ ret = btrfs_subvolid_resolve(fd, buf, size, rootid);
++ if (ret < 0)
++ return ret;
++ ret = subvol_path_of_fd(fd, rel, sizeof(rel));
++ if (ret < 0)
++ return ret;
++ if (!rel[0])
++ return 0;
++ if (strlen(buf) + 1 + strlen(rel) + 1 > size)
+ return -EOVERFLOW;
+ if (buf[0])
+ strcat(buf, "/");
-+ strcat(buf, args.name);
++ strcat(buf, rel);
+ return 0;
+}
+
++/* A mount of a directory inside a subvolume, see subvol_lookup_bind() */
++struct subvol_bind {
++ /* Mount point */
++ char path[PATH_MAX];
++ /* The mounted directory relative to the subvolume root */
++ char rel[PATH_MAX];
++};
++
+struct subvol_lookup {
+ /* In: subvolume id, its path from the top level, filesystem fsid */
+ u64 root;
+ const char *subvol;
+ u8 fsid[BTRFS_FSID_SIZE];
+ /*
-+ * Out: open subvolume root (or, with @strip set, a directory of the
-+ * subvolume: the path of that directory relative to the subvolume
-+ * root), its path from user's view, how matched
++ * Out: open subvolume root, through the mount of the deepest ancestor
++ * of the subvolume (or of the subvolume itself), its path from user's
++ * view, how matched
+ */
+ int fd;
+ char path[PATH_MAX];
-+ char strip[PATH_MAX];
+ size_t matched_len;
++ /*
++ * Out: mounts of directories inside the subvolume, in mountinfo
++ * order, and an open fd of the first one
++ */
++ struct subvol_bind *binds;
++ int nr_binds;
++ int bind_fd;
+};
+
+/*
+}
+
+/*
++ * A mount at @mnt that is not an ancestor of the subvolume: if it is a
++ * directory inside the subvolume (for example a bind mount of a
++ * directory), on the same filesystem, remember it and the directory's path
++ * in the subvolume. The path comes from the inode, not from the mountinfo
++ * text, so a renamed directory is found where it is now, and a deleted one
++ * is skipped. A mount of a directory of another subvolume, nested in this
++ * one or containing it, fails the root id check.
++ */
++static void subvol_lookup_bind(struct subvol_lookup *sl, const char *mnt)
++{
++ struct btrfs_ioctl_fs_info_args fi = { 0 };
++ struct subvol_bind *binds;
++ char rel[PATH_MAX];
++ u64 rootid;
++ int fd;
++
++ fd = open(mnt, O_RDONLY | O_DIRECTORY);
++ if (fd < 0)
++ return;
++ if (lookup_path_rootid(fd, &rootid) < 0 || rootid != sl->root ||
++ ioctl(fd, BTRFS_IOC_FS_INFO, &fi) < 0 ||
++ memcmp(fi.fsid, sl->fsid, BTRFS_FSID_SIZE) != 0 ||
++ subvol_path_of_fd(fd, rel, sizeof(rel)) < 0)
++ goto out;
++ binds = realloc(sl->binds, (sl->nr_binds + 1) * sizeof(*binds));
++ if (!binds)
++ goto out;
++ sl->binds = binds;
++ strncpy_null(binds[sl->nr_binds].path, mnt, PATH_MAX);
++ strncpy_null(binds[sl->nr_binds].rel, rel, PATH_MAX);
++ sl->nr_binds++;
++ if (sl->bind_fd < 0) {
++ sl->bind_fd = fd;
++ return;
++ }
++out:
++ close(fd);
++}
++
++/*
+ * Callback of iterate_btrfs_mounts(): pick the mount of the deepest ancestor
+ * of the subvolume (or of the subvolume itself), whatever its name, if it
+ * belongs to the same filesystem and the subvolume is reachable under it.
++ * Collect the mounts of directories inside the subvolume too.
+ */
+static int subvol_lookup_mount(const char *fsroot, const char *mnt, void *priv)
+{
+ while (fsroot[0] == '/')
+ fsroot++;
+ rest = path_below(sl->subvol, fsroot);
-+ if (!rest)
++ if (!rest) {
++ if (path_below(fsroot, sl->subvol))
++ subvol_lookup_bind(sl, mnt);
+ return 0;
++ }
+ len = strlen(fsroot) + 1;
+ if (sl->fd >= 0 && len <= sl->matched_len)
+ return 0;
+}
+
+/*
-+ * Open the root directory of subvolume @root of the filesystem that @fd (the
-+ * user's @arg) belongs to, and store the path to print in front of the inode
-+ * paths in @sl->path. Prefer a path below @arg, as logical-resolve did
-+ * before v5.10, so that paths are printed as the user named them; then a
-+ * mount point of the subvolume or of any of its ancestors.
++ * The mount of a directory inside the subvolume that @name (relative to the
++ * subvolume root) is below: the one closest to the subvolume root, the
++ * first in mountinfo order among equals. Store the rest of @name in @rest.
++ */
++static const struct subvol_bind *subvol_bind_for(const struct subvol_lookup *sl,
++ const char *name,
++ const char **rest)
++{
++ const struct subvol_bind *best = NULL;
++ int i;
++
++ for (i = 0; i < sl->nr_binds; i++) {
++ const struct subvol_bind *b = &sl->binds[i];
++ const char *r = path_below(name, b->rel);
++
++ if (!r || !r[0])
++ continue;
++ if (best && strlen(b->rel) >= strlen(best->rel))
++ continue;
++ best = b;
++ *rest = r;
++ }
++ return best;
++}
++
++/*
++ * Print the paths of inode @inum of subvolume @root of the filesystem that
++ * @fd (the user's @arg, at @arg_fs_path in the filesystem, filesystem id
++ * @fsid) belongs to. Each path is printed through the first of these that
++ * reaches it:
+ *
-+ * If @arg is a directory inside the subvolume rather than its root or one of
-+ * its ancestors (for example a bind mount of a directory, or a directory in
-+ * one), return a new fd of @arg instead and set @sl->strip to the path of
-+ * @arg in the subvolume: only the inode paths below it can be printed
-+ * relative to @arg. @no_inside skips this, to look for the subvolume in the
-+ * mounts when no path of the inode is below @arg.
++ * 1. Below @arg: the subvolume's path is @arg's or below it. Paths are
++ * printed relative to @arg as given, as logical-resolve did before v5.10.
++ * 2. Inside @arg: @arg is a directory of the subvolume itself below its
++ * root (for example a bind mount of a directory, or a directory in one).
++ * The paths below @arg are printed relative to it.
++ * 3. The mount of the deepest ancestor of the subvolume, or of itself.
++ * 4. The mount of a directory inside the subvolume that the path is below.
+ *
-+ * Return a new fd, or -errno.
++ * Route 1 and 3 open the subvolume root and reach every path; route 2 and
++ * 4 reach only the paths below their directory. Paths that no route
++ * reaches, or the whole inode if no route reaches the subvolume, are
++ * reported as not mounted. Return 0, or 1 if a lookup failed.
+ */
-+static int open_subvol_for_root(int fd, const char *arg, const char *arg_fs_path,
-+ const u8 *fsid, u64 root, bool no_inside,
-+ struct subvol_lookup *sl)
++static int resolve_ino_paths(int fd, const char *arg, const char *arg_fs_path,
++ const u8 *fsid, u64 root, u64 inum)
+{
+ char subvol[PATH_MAX];
++ char pathbuf[PATH_MAX];
++ const struct btrfs_data_container *fspath = (const void *)pathbuf;
++ struct subvol_lookup sl = { 0 };
++ const char *strip = NULL;
+ const char *rest;
++ bool need_mounts = true;
+ u64 arg_root;
-+ int ret;
++ int names_fd;
++ int ret = 0;
++ int i;
+
-+ memset(sl, 0, sizeof(*sl));
-+ sl->fd = -1;
-+ sl->root = root;
-+ memcpy(sl->fsid, fsid, BTRFS_FSID_SIZE);
++ sl.fd = -1;
++ sl.bind_fd = -1;
++ sl.root = root;
++ memcpy(sl.fsid, fsid, BTRFS_FSID_SIZE);
+
-+ ret = btrfs_subvolid_resolve(fd, subvol, sizeof(subvol), root);
-+ if (ret < 0)
-+ return ret;
-+ sl->subvol = subvol;
++ if (btrfs_subvolid_resolve(fd, subvol, sizeof(subvol), root) < 0) {
++ printf("inode %llu subvol <id %llu> could not be accessed: not mounted\n",
++ inum, root);
++ return 0;
++ }
++ sl.subvol = subvol;
+
+ rest = path_below(subvol, arg_fs_path);
+ if (rest) {
-+ ret = open_subvol_checked(sl, arg, rest, sl->path, sizeof(sl->path));
-+ if (ret >= 0)
++ names_fd = open_subvol_checked(&sl, arg, rest, sl.path,
++ sizeof(sl.path));
++ if (names_fd >= 0) {
++ ret = __ino_to_path_fd(inum, names_fd, sl.path);
++ close(names_fd);
+ return ret;
++ }
+ }
+
+ /*
+ * filesystem by definition), below its root directory
+ */
+ rest = path_below(arg_fs_path, subvol);
-+ if (!no_inside && rest && rest[0] &&
++ if (rest && rest[0] &&
+ lookup_path_rootid(fd, &arg_root) == 0 && arg_root == root) {
-+ ret = dup(fd);
-+ if (ret < 0)
-+ return -errno;
-+ strncpy_null(sl->path, arg, sizeof(sl->path));
-+ strncpy_null(sl->strip, rest, sizeof(sl->strip));
-+ return ret;
++ strip = rest;
++ ret = ino_paths(inum, fd, pathbuf);
++ if (ret)
++ return ret;
++ need_mounts = false;
++ for (i = 0; i < fspath->elem_cnt; i++) {
++ rest = path_below(ino_path(pathbuf, i), strip);
++ if (!rest || !rest[0])
++ need_mounts = true;
++ }
+ }
+
-+ ret = iterate_btrfs_mounts(subvol_lookup_mount, sl);
-+ if (ret < 0)
-+ return ret;
-+ if (sl->fd < 0)
-+ return -ENOENT;
-+ return sl->fd;
++ /* If the mounts cannot be read, only routes 1 and 2 are left */
++ if (need_mounts)
++ iterate_btrfs_mounts(subvol_lookup_mount, &sl);
++
++ if (!strip) {
++ names_fd = sl.fd >= 0 ? sl.fd : sl.bind_fd;
++ if (names_fd < 0) {
++ printf("inode %llu subvol %s could not be accessed: not mounted\n",
++ inum, subvol[0] ? subvol : "<FS_TREE>");
++ goto out;
++ }
++ ret = ino_paths(inum, names_fd, pathbuf);
++ if (ret)
++ goto out;
++ }
++
++ for (i = 0; i < fspath->elem_cnt; i++) {
++ const char *name = ino_path(pathbuf, i);
++ const struct subvol_bind *b;
++
++ if (strip) {
++ rest = path_below(name, strip);
++ if (rest && rest[0]) {
++ print_ino_path(arg, rest);
++ continue;
++ }
++ }
++ if (sl.fd >= 0) {
++ print_ino_path(sl.path, name);
++ continue;
++ }
++ b = subvol_bind_for(&sl, name, &rest);
++ if (b) {
++ print_ino_path(b->path, rest);
++ continue;
++ }
++ printf("inode %llu subvol %s path %s could not be accessed: not mounted\n",
++ inum, subvol[0] ? subvol : "<FS_TREE>", name);
++ }
++out:
++ if (sl.fd >= 0)
++ close(sl.fd);
++ if (sl.bind_fd >= 0)
++ close(sl.bind_fd);
++ free(sl.binds);
++ return ret;
+}
+
static const char * const cmd_inspect_logical_resolve_usage[] = {
"btrfs inspect-internal logical-resolve [-Pvo] [-s bufsize] <logical> <path>",
"Get file system paths for the given logical address",
-@@ -163,12 +390,11 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
+@@ -163,12 +556,11 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
int fd;
int i;
bool getpath = true;
u64 flags = 0;
unsigned long request = BTRFS_IOC_LOGICAL_INO;
-@@ -230,13 +456,22 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
+@@ -230,13 +622,22 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
(unsigned long)inodes->bytes_missing, inodes->elem_cnt,
inodes->elem_missed);
}
ret = 0;
-@@ -244,68 +479,46 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
+@@ -244,68 +645,18 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
u64 inum = inodes->val[i];
u64 offset = inodes->val[i+1];
u64 root = inodes->val[i+2];
-+ struct subvol_lookup sl;
- int path_fd;
-+ int ret2;
-
+- int path_fd;
+-
- if (getpath) {
- char mount_path[PATH_MAX];
- char name[PATH_MAX];
- ret = btrfs_subvolid_resolve(fd, name, sizeof(name), root);
- if (ret < 0)
- goto out;
--
++ int ret2;
+
- if (name[0] == 0) {
- path_ptr[-1] = '\0';
- path_fd = fd;
+ if (!getpath) {
pr_default("inode %llu offset %llu root %llu\n", inum,
offset, root);
-+ continue;
-+ }
-+
-+ path_fd = open_subvol_for_root(fd, argv[optind + 1], arg_fs_path,
-+ fsid, root, false, &sl);
-+ if (path_fd >= 0 && sl.strip[0]) {
-+ int printed = 0;
-+
-+ ret2 = ino_to_path_fd_below(inum, path_fd, sl.path,
-+ sl.strip, &printed);
-+ close(path_fd);
-+ if (ret2)
-+ ret = ret2;
-+ if (ret2 || printed)
-+ continue;
-+ /* No path of the inode is below @arg, try the mounts */
-+ path_fd = open_subvol_for_root(fd, argv[optind + 1],
-+ arg_fs_path, fsid, root,
-+ true, &sl);
-+ }
-+ if (path_fd < 0) {
-+ char name[PATH_MAX];
-+
-+ if (btrfs_subvolid_resolve(fd, name, sizeof(name), root) < 0)
-+ snprintf(name, sizeof(name), "<id %llu>", root);
-+ printf("inode %llu subvol %s could not be accessed: not mounted\n",
-+ inum, name[0] ? name : "<FS_TREE>");
+ continue;
}
-+ ret2 = __ino_to_path_fd(inum, path_fd, sl.path);
++
++ ret2 = resolve_ino_paths(fd, argv[optind + 1], arg_fs_path,
++ fsid, root, inum);
+ if (ret2)
+ ret = ret2;
-+ close(path_fd);
}
out:
+@@ -1633,3 +1984,4 @@ static const struct cmd_group inspect_cmd_group = {
+ };
+
+ DEFINE_GROUP_COMMAND(inspect, "inspect-internal");
++
diff --git a/common/utils.c b/common/utils.c
index 11ca82f8..f6165abb 100644
--- a/common/utils.c
-From eb127d09ca5cefed488c55633764f86810b5c977 Mon Sep 17 00:00:00 2001
+From 3f2c3c53d5a49700c3e0f424caae0df7c0e01164 Mon Sep 17 00:00:00 2001
From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Date: Fri, 30 Oct 2026 17:18:00 -0400
Subject: [PATCH 3/4] btrfs-progs: inspect inode-resolve: print paths relative
# btrfs inspect-internal inode-resolve 257 /mnt/bind
/mnt/bind/dir/file
-Find the argument's path in its subvolume with INO_LOOKUP and print only
-the paths below it, relative to it, as logical-resolve does for its path
-argument. Paths of other hard links outside the argument cannot be
-printed relative to it; count them, report them on stderr and exit with
-status 1, so that missing names are not silent. When the argument is the
+When the argument is a directory inside its subvolume, resolve the
+paths with the routes logical-resolve uses for its references: print the
+paths below the argument relative to it, and the others through the
+mount of the subvolume or of an ancestor, or through a bind mount of a
+directory they are below. A path that no mount reaches is reported as
+not mounted, like in logical-resolve. When the argument is the
subvolume root nothing changes.
-The INO_LOOKUP part of fs_path_of_fd() becomes subvol_path_of_fd(), used
-by both commands.
+Add misc-tests/074-inspect-internal-inode-resolve: the subvolume root,
+a directory in it, ".", a bind mount of a directory as the argument,
+then hard links outside the argument, resolved through the mount of the
+subvolume, through a bind mount of their directory, or not at all.
Link: https://github.com/kdave/btrfs-progs/issues/400
Fixes: 6055e736045d ("Btrfs-progs: added ioctls and commands to resolve inodes and logical addrs")
Assisted-by: Claude:claude-opus-5-5
---
- cmds/inspect.c | 93 ++++++++++++++-----
- .../test.sh | 59 ++++++++++++
- 2 files changed, 129 insertions(+), 23 deletions(-)
+ cmds/inspect.c | 39 +++++++-
+ .../test.sh | 92 +++++++++++++++++++
+ 2 files changed, 129 insertions(+), 2 deletions(-)
+ create mode 100755 tests/misc-tests/074-inspect-internal-inode-resolve/test.sh
diff --git a/cmds/inspect.c b/cmds/inspect.c
-index 8f12c6ed..f01a6b73 100644
+index baa3d6e4..3d9a7ef8 100644
--- a/cmds/inspect.c
+++ b/cmds/inspect.c
-@@ -59,10 +59,10 @@ static const char * const inspect_cmd_group_usage[] = {
- * Print the paths of inode @inum in the subvolume of @fd, each after
- * @prepend. If @strip is set, print only the paths below the directory
- * @strip (relative to the subvolume root), without that part, and count
-- * them in @printed.
-+ * them in @printed; count the paths not below @strip in @skipped.
- */
- static int ino_to_path_fd_below(u64 inum, int fd, const char *prepend,
-- const char *strip, int *printed)
-+ const char *strip, int *printed, int *skipped)
- {
- int ret;
- int i;
-@@ -95,8 +95,11 @@ static int ino_to_path_fd_below(u64 inum, int fd, const char *prepend,
- if (strip) {
- size_t len = strlen(strip);
-
-- if (strncmp(str, strip, len) != 0 || str[len] != '/')
-+ if (strncmp(str, strip, len) != 0 || str[len] != '/') {
-+ if (skipped)
-+ (*skipped)++;
- continue;
-+ }
- str += len + 1;
- }
- if (printed)
-@@ -113,7 +116,36 @@ out:
-
- static int __ino_to_path_fd(u64 inum, int fd, const char *prepend)
- {
-- return ino_to_path_fd_below(inum, fd, prepend, NULL, NULL);
-+ return ino_to_path_fd_below(inum, fd, prepend, NULL, NULL, NULL);
-+}
-+
-+/*
-+ * Path of the directory open at @fd relative to the root of its subvolume,
-+ * without leading or trailing slash ("" for the subvolume root).
-+ */
-+static int subvol_path_of_fd(int fd, char *buf, size_t size)
-+{
-+ struct btrfs_ioctl_ino_lookup_args args = { 0 };
-+ struct stat st;
-+ size_t len;
-+
-+ buf[0] = 0;
-+ if (fstat(fd, &st) < 0)
-+ return -errno;
-+ if (st.st_ino == BTRFS_FIRST_FREE_OBJECTID)
-+ return 0;
-+
-+ /* treeid 0 is the subvolume of @fd, the path ends with a slash */
-+ args.objectid = st.st_ino;
-+ if (ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args) < 0)
-+ return -errno;
-+ len = strlen(args.name);
-+ if (len && args.name[len - 1] == '/')
-+ args.name[--len] = 0;
-+ if (len + 1 > size)
-+ return -EOVERFLOW;
-+ memcpy(buf, args.name, len + 1);
-+ return 0;
+@@ -115,6 +115,10 @@ static int __ino_to_path_fd(u64 inum, int fd, const char *prepend)
+ return 0;
}
++static int fs_path_of_fd(int fd, char *buf, size_t size);
++static int resolve_ino_paths(int fd, const char *arg, const char *arg_fs_path,
++ const u8 *fsid, u64 root, u64 inum);
++
static const char * const cmd_inspect_inode_resolve_usage[] = {
-@@ -129,6 +161,10 @@ static const char * const cmd_inspect_inode_resolve_usage[] = {
+ "btrfs inspect-internal inode-resolve [-v] <inode> <path>",
+ "Get file system paths for the given inode",
+@@ -128,6 +132,12 @@ static const char * const cmd_inspect_inode_resolve_usage[] = {
static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
int argc, char **argv)
{
-+ char rel[PATH_MAX];
++ struct btrfs_ioctl_fs_info_args fi = { 0 };
++ char arg_fs_path[PATH_MAX];
+ const char *path;
-+ int skipped = 0;
++ struct stat st;
+ u64 inum;
++ u64 root;
int fd;
int ret;
-@@ -154,8 +190,29 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
- if (fd < 0)
+@@ -149,11 +159,36 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
+ if (check_argc_exact(argc - optind, 2))
return 1;
-- ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd, argv[optind+1]);
+- fd = btrfs_open_dir(argv[optind + 1]);
+ inum = arg_strtou64(argv[optind]);
+ path = argv[optind + 1];
++ fd = btrfs_open_dir(path);
+ if (fd < 0)
+ return 1;
+
+- ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd, argv[optind+1]);
++ /* The inode paths are relative to the subvolume root */
++ if (fstat(fd, &st) == 0 && st.st_ino == BTRFS_FIRST_FREE_OBJECTID) {
++ ret = __ino_to_path_fd(inum, fd, path);
++ close(fd);
++ return !!ret;
++ }
+
+ /*
-+ * The inode paths are relative to the subvolume root, print only those
-+ * below @path and relative to it when @path is a directory inside the
-+ * subvolume.
++ * @path is a directory inside the subvolume: print the paths below it
++ * relative to it, and the others through the mounts, like
++ * logical-resolve
+ */
-+ ret = subvol_path_of_fd(fd, rel, sizeof(rel));
++ ret = lookup_path_rootid(fd, &root);
++ if (ret == 0 && ioctl(fd, BTRFS_IOC_FS_INFO, &fi) < 0)
++ ret = -errno;
++ if (ret == 0)
++ ret = fs_path_of_fd(fd, arg_fs_path, sizeof(arg_fs_path));
+ if (ret < 0) {
+ errno = -ret;
+ error("cannot find the subvolume path of %s: %m", path);
+ close(fd);
+ return 1;
+ }
-+ ret = ino_to_path_fd_below(inum, fd, path, rel[0] ? rel : NULL, NULL,
-+ &skipped);
++ ret = resolve_ino_paths(fd, path, arg_fs_path, fi.fsid, root, inum);
close(fd);
-+ if (skipped) {
-+ error("inode %llu: %d path%s not below %s",
-+ inum, skipped, skipped == 1 ? "" : "s", path);
-+ return 1;
-+ }
return !!ret;
- }
-@@ -187,10 +244,8 @@ static const char *path_below(const char *path, const char *prefix)
- */
- static int fs_path_of_fd(int fd, char *buf, size_t size)
- {
-- struct btrfs_ioctl_ino_lookup_args args = { 0 };
-- struct stat st;
-+ char rel[PATH_MAX];
- u64 rootid;
-- size_t len;
- int ret;
-
- ret = lookup_path_rootid(fd, &rootid);
-@@ -199,24 +254,16 @@ static int fs_path_of_fd(int fd, char *buf, size_t size)
- ret = btrfs_subvolid_resolve(fd, buf, size, rootid);
- if (ret < 0)
- return ret;
-- if (fstat(fd, &st) < 0)
-- return -errno;
-- if (st.st_ino == BTRFS_FIRST_FREE_OBJECTID)
-+ ret = subvol_path_of_fd(fd, rel, sizeof(rel));
-+ if (ret < 0)
-+ return ret;
-+ if (!rel[0])
- return 0;
--
-- /* A directory inside the subvolume, its path ends with a slash */
-- args.treeid = rootid;
-- args.objectid = st.st_ino;
-- if (ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args) < 0)
-- return -errno;
-- len = strlen(args.name);
-- if (len && args.name[len - 1] == '/')
-- args.name[--len] = 0;
-- if (strlen(buf) + 1 + len + 1 > size)
-+ if (strlen(buf) + 1 + strlen(rel) + 1 > size)
- return -EOVERFLOW;
- if (buf[0])
- strcat(buf, "/");
-- strcat(buf, args.name);
-+ strcat(buf, rel);
- return 0;
- }
-
-@@ -495,7 +542,7 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
- int printed = 0;
-
- ret2 = ino_to_path_fd_below(inum, path_fd, sl.path,
-- sl.strip, &printed);
-+ sl.strip, &printed, NULL);
- close(path_fd);
- if (ret2)
- ret = ret2;
-diff --git a/tests/misc-tests/042-inspect-internal-logical-resolve/test.sh b/tests/misc-tests/042-inspect-internal-logical-resolve/test.sh
-index 0ef90e93..448fafea 100755
---- a/tests/misc-tests/042-inspect-internal-logical-resolve/test.sh
-+++ b/tests/misc-tests/042-inspect-internal-logical-resolve/test.sh
-@@ -82,3 +82,62 @@ for offset in $("$TOP/btrfs" inspect-internal dump-tree -t "$subvol1id" "$TEST_D
- done
-
- run_check_umount_test_dev
+diff --git a/tests/misc-tests/074-inspect-internal-inode-resolve/test.sh b/tests/misc-tests/074-inspect-internal-inode-resolve/test.sh
+new file mode 100755
+index 00000000..22ace0ca
+--- /dev/null
++++ b/tests/misc-tests/074-inspect-internal-inode-resolve/test.sh
+@@ -0,0 +1,92 @@
++#!/bin/bash
++# Check that inode-resolve prints the paths of an inode relative to its path
++# argument when the argument is a directory inside the subvolume, a bind
++# mount of one, or a relative path, and that the paths outside the argument
++# are printed through the other mounts or reported as not mounted.
++
++source "$TEST_TOP/common" || exit
++
++check_prereq btrfs
++check_prereq mkfs.btrfs
++
++setup_root_helper
++prepare_test_dev
+
-+# Resolve inode $1 with $2 as the path argument: the printed paths must be
-+# exactly $4..., and the command must exit with status $3, which is 1 if
-+# some paths are not below $2
++# A path of the inode that no mount reaches
++unreachable_re='^inode [0-9]+ subvol .* path .* could not be accessed: not mounted$'
++unreachable_ret=0
++
++# Resolve inode $1 with $2 as the path argument: $3 paths must be reported
++# as not mounted, and the printed paths must be exactly $4...
+check_inode_resolve()
+{
+ local ino="$1"
+ local path="$2"
-+ local want_ret="$3"
++ local want_unreachable="$3"
++ local want_ret=0
+ local output
++ local unreachable
+ local ret
+ local got
+ local want
+ output=$(run_mayfail_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal \
+ inode-resolve "$ino" "$path")
+ ret=$?
-+ got=$(grep -v '^ERROR: ' <<< "$output" | sort)
++ got=$(grep -Ev "$unreachable_re" <<< "$output" | sort)
++ unreachable=$(grep -Ec "$unreachable_re" <<< "$output")
+ want=$(printf '%s\n' "$@" | sort)
+ if [ "$got" != "$want" ]; then
+ _fail "inode-resolve $ino $path printed '$got', not '$want'"
+ fi
++ if [ "$unreachable" -ne "$want_unreachable" ]; then
++ _fail "inode-resolve $ino $path: $unreachable not mounted, not $want_unreachable"
++ fi
++ [ "$want_unreachable" -ne 0 ] && want_ret="$unreachable_ret"
+ if [ "$ret" -ne "$want_ret" ]; then
+ _fail "inode-resolve $ino $path exited with $ret, not $want_ret"
+ fi
-+ if [ "$want_ret" -ne 0 ] &&
-+ ! grep -q "^ERROR: inode $ino: .* not below $path\$" <<< "$output"; then
-+ _fail "inode-resolve $ino $path did not report the paths not below it"
-+ fi
+}
+
-+# inode-resolve prints the paths relative to its path argument, which can be
-+# a directory inside the subvolume, a bind mount of one, or a relative path.
-+# A path that is not below the argument is reported on stderr instead.
-+run_check $SUDO_HELPER mount -o subvol=/@/vol1 "$TEST_DEV" "$TEST_MNT"
-+run_check $SUDO_HELPER mkdir -p "$TEST_MNT/idir/sub"
-+run_check $SUDO_HELPER touch "$TEST_MNT/idir/sub/ifile"
-+ino=$(stat -c %i "$TEST_MNT/idir/sub/ifile")
++run_check_mkfs_test_dev
++run_check_mount_test_dev
++run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/vol"
++run_check_umount_test_dev
+
-+check_inode_resolve "$ino" "$TEST_MNT" 0 "$TEST_MNT/idir/sub/ifile"
-+check_inode_resolve "$ino" "$TEST_MNT/idir" 0 "$TEST_MNT/idir/sub/ifile"
-+( cd "$TEST_MNT/idir" && check_inode_resolve "$ino" . 0 ./sub/ifile ) ||
++run_check $SUDO_HELPER mount -o subvol=/vol "$TEST_DEV" "$TEST_MNT"
++run_check $SUDO_HELPER mkdir -p "$TEST_MNT/idir/sub" "$TEST_MNT/ldir"
++run_check $SUDO_HELPER touch "$TEST_MNT/idir/sub/file"
++ino=$(stat -c %i "$TEST_MNT/idir/sub/file")
++
++# The subvolume root, a directory in it, "." and a bind mount of a directory
++check_inode_resolve "$ino" "$TEST_MNT" 0 "$TEST_MNT/idir/sub/file"
++check_inode_resolve "$ino" "$TEST_MNT/idir" 0 "$TEST_MNT/idir/sub/file"
++( cd "$TEST_MNT/idir" && check_inode_resolve "$ino" . 0 ./sub/file ) ||
+ _fail "inode-resolve $ino in idir"
+
-+run_check mkdir -p mnt6
-+run_check $SUDO_HELPER mount --bind "$TEST_MNT/idir" mnt6
-+check_inode_resolve "$ino" mnt6 0 mnt6/sub/ifile
-+check_inode_resolve "$ino" mnt6/sub 0 mnt6/sub/ifile
++bind1=$(_mktemp_dir inode-resolve-bind1)
++bind2=$(_mktemp_dir inode-resolve-bind2)
++run_check $SUDO_HELPER mount --bind "$TEST_MNT/idir" "$bind1"
++run_check $SUDO_HELPER mount --bind "$TEST_MNT/ldir" "$bind2"
++check_inode_resolve "$ino" "$bind1" 0 "$bind1/sub/file"
++check_inode_resolve "$ino" "$bind1/sub" 0 "$bind1/sub/file"
+
-+# A second name outside idir
-+run_check $SUDO_HELPER ln "$TEST_MNT/idir/sub/ifile" "$TEST_MNT/ilink"
-+check_inode_resolve "$ino" "$TEST_MNT" 0 "$TEST_MNT/idir/sub/ifile" "$TEST_MNT/ilink"
-+check_inode_resolve "$ino" mnt6 1 mnt6/sub/ifile
-+check_inode_resolve "$ino" "$TEST_MNT/idir/sub" 1 "$TEST_MNT/idir/sub/ifile"
++# Hard links outside idir are printed through the mount of the subvolume
++run_check $SUDO_HELPER ln "$TEST_MNT/idir/sub/file" "$TEST_MNT/ldir/link"
++run_check $SUDO_HELPER ln "$TEST_MNT/idir/sub/file" "$TEST_MNT/link"
++check_inode_resolve "$ino" "$TEST_MNT" 0 "$TEST_MNT/idir/sub/file" \
++ "$TEST_MNT/ldir/link" "$TEST_MNT/link"
++check_inode_resolve "$ino" "$bind1" 0 "$bind1/sub/file" \
++ "$TEST_MNT/ldir/link" "$TEST_MNT/link"
++check_inode_resolve "$ino" "$TEST_MNT/idir/sub" 0 "$TEST_MNT/idir/sub/file" \
++ "$TEST_MNT/ldir/link" "$TEST_MNT/link"
+
-+run_check_umount_test_dev mnt6
-+run_check rmdir -- mnt6
++# Without it, through the bind mount of the directory they are in, if any
+run_check_umount_test_dev "$TEST_MNT"
++check_inode_resolve "$ino" "$bind1" 1 "$bind1/sub/file" "$bind2/link"
++check_inode_resolve "$ino" "$bind2" 1 "$bind2/link" "$bind1/sub/file"
++
++run_check_umount_test_dev "$bind2"
++run_check_umount_test_dev "$bind1"
++run_check rmdir -- "$bind1" "$bind2"
--
2.47.3
-From da97c420ee4aeebef7f405b7dd45ad47865d33b8 Mon Sep 17 00:00:00 2001
+From bed8b5eb14d775f96649a15b19da6ba5d3f816b7 Mon Sep 17 00:00:00 2001
From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Date: Thu, 29 Oct 2026 23:34:39 -0400
Subject: [PATCH 4/4] btrfs-progs: inspect logical-resolve: fail on an
When the subvolume of a reference cannot be opened, logical-resolve
prints "inode N subvol S could not be accessed: not mounted" to stdout
and exits with status 0, so a script that reads the paths sees fewer
-paths, or none at all, and no error.
+paths, or none at all, and no error. The same goes for a path of an
+inode that no mount reaches ("inode N subvol S path P could not be
+accessed: not mounted"), in logical-resolve and inode-resolve.
-Report it as an error on stderr and exit with status 1 once all the
-other references have been printed.
+Report them as errors on stderr and exit with status 1 once all the
+other paths have been printed.
This changes the output: scripts that parsed the message from stdout
will no longer see it there.
of a subvolume with a file in it and a subvolume nested below it, and a
directory of that nested subvolume, each resolved with the bind mount
point, a directory in it, "." and an absolute path as the argument, and
-checked to print the expected path relative to the argument.
+checked to print the expected path relative to the argument, and a
+file reached through the bind mount of its directory when the argument
+is elsewhere. Update misc-tests/074 for the stderr message and exit
+status.
Link: https://github.com/kdave/btrfs-progs/issues/400
Assisted-by: Claude:claude-opus-5-5
---
- cmds/inspect.c | 5 +-
- .../test.sh | 101 +++++++++++++++++-
- 2 files changed, 101 insertions(+), 5 deletions(-)
+ cmds/inspect.c | 19 ++--
+ .../test.sh | 104 +++++++++++++++++-
+ .../test.sh | 7 +-
+ 3 files changed, 116 insertions(+), 14 deletions(-)
diff --git a/cmds/inspect.c b/cmds/inspect.c
-index f01a6b73..36d892ca 100644
+index 3d9a7ef8..e1ad1579 100644
--- a/cmds/inspect.c
+++ b/cmds/inspect.c
-@@ -558,8 +558,9 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd,
+@@ -461,7 +461,8 @@ static const struct subvol_bind *subvol_bind_for(const struct subvol_lookup *sl,
+ * Route 1 and 3 open the subvolume root and reach every path; route 2 and
+ * 4 reach only the paths below their directory. Paths that no route
+ * reaches, or the whole inode if no route reaches the subvolume, are
+- * reported as not mounted. Return 0, or 1 if a lookup failed.
++ * reported as not mounted, on stderr. Return 0, or 1 if a lookup failed or
++ * a path was not reached.
+ */
+ static int resolve_ino_paths(int fd, const char *arg, const char *arg_fs_path,
+ const u8 *fsid, u64 root, u64 inum)
+@@ -484,9 +485,9 @@ static int resolve_ino_paths(int fd, const char *arg, const char *arg_fs_path,
+ memcpy(sl.fsid, fsid, BTRFS_FSID_SIZE);
- if (btrfs_subvolid_resolve(fd, name, sizeof(name), root) < 0)
- snprintf(name, sizeof(name), "<id %llu>", root);
+ if (btrfs_subvolid_resolve(fd, subvol, sizeof(subvol), root) < 0) {
+- printf("inode %llu subvol <id %llu> could not be accessed: not mounted\n",
+- inum, root);
+- return 0;
++ error("inode %llu subvol <id %llu> could not be accessed: not mounted",
++ inum, root);
++ return 1;
+ }
+ sl.subvol = subvol;
+
+@@ -527,8 +528,9 @@ static int resolve_ino_paths(int fd, const char *arg, const char *arg_fs_path,
+ if (!strip) {
+ names_fd = sl.fd >= 0 ? sl.fd : sl.bind_fd;
+ if (names_fd < 0) {
- printf("inode %llu subvol %s could not be accessed: not mounted\n",
-- inum, name[0] ? name : "<FS_TREE>");
+- inum, subvol[0] ? subvol : "<FS_TREE>");
+ error("inode %llu subvol %s could not be accessed: not mounted",
-+ inum, name[0] ? name : "<FS_TREE>");
-+ ret = -ENOENT;
++ inum, subvol[0] ? subvol : "<FS_TREE>");
++ ret = 1;
+ goto out;
+ }
+ ret = ino_paths(inum, names_fd, pathbuf);
+@@ -556,8 +558,9 @@ static int resolve_ino_paths(int fd, const char *arg, const char *arg_fs_path,
+ print_ino_path(b->path, rest);
continue;
}
- ret2 = __ino_to_path_fd(inum, path_fd, sl.path);
+- printf("inode %llu subvol %s path %s could not be accessed: not mounted\n",
+- inum, subvol[0] ? subvol : "<FS_TREE>", name);
++ error("inode %llu subvol %s path %s could not be accessed: not mounted",
++ inum, subvol[0] ? subvol : "<FS_TREE>", name);
++ ret = 1;
+ }
+ out:
+ if (sl.fd >= 0)
diff --git a/tests/misc-tests/042-inspect-internal-logical-resolve/test.sh b/tests/misc-tests/042-inspect-internal-logical-resolve/test.sh
-index 448fafea..a28d28c9 100755
+index 0ef90e93..591b78b9 100755
--- a/tests/misc-tests/042-inspect-internal-logical-resolve/test.sh
+++ b/tests/misc-tests/042-inspect-internal-logical-resolve/test.sh
@@ -11,22 +11,54 @@ prepare_test_dev
run_check "$TOP/btrfs" filesystem sync "$TEST_MNT"
run_check_umount_test_dev
-@@ -83,6 +131,53 @@ done
+@@ -82,3 +130,53 @@ for offset in $("$TOP/btrfs" inspect-internal dump-tree -t "$subvol1id" "$TEST_D
+ done
run_check_umount_test_dev
-
++
+# Print the logical addresses of the extents of inode $2 in tree $1
+inode_offsets()
+{
+# Bind mounts of directories are the only way in: mnt4 is vol1's directory
+# bdir, mnt5 the directory d2 of the nested subvol2. Paths are printed
+# relative to the path argument, which can be the bind mount point, a
-+# directory in it, or a relative path.
++# directory in it, or a relative path. With mnt5 as the argument, file3 is
++# reached through the bind mount of its directory, as $PWD/mnt4 (the mount
++# point as listed in mountinfo).
+run_check $SUDO_HELPER mount -o subvol=/@/vol1 "$TEST_DEV" "$TEST_MNT"
+run_check mkdir -p mnt4 mnt5
+run_check $SUDO_HELPER mount --bind "$TEST_MNT/bdir" mnt4
+ check_logical_offset_filename "$offset" "$PWD/mnt4" "$PWD/mnt4/file3"
+ ( cd mnt4 && check_logical_offset_filename "$offset" . ./file3 ) ||
+ _fail "logical-resolve $offset in mnt4"
++ check_logical_offset_filename "$offset" mnt5 "$PWD/mnt4/file3"
+done
+for offset in $file4offsets; do
+ check_logical_offset_filename "$offset" mnt4 mnt4/sub/subvol2/file4
+run_check_umount_test_dev mnt5
+run_check_umount_test_dev mnt4
+run_check rmdir -- mnt4 mnt5
-+
- # Resolve inode $1 with $2 as the path argument: the printed paths must be
- # exactly $4..., and the command must exit with status $3, which is 1 if
- # some paths are not below $2
+diff --git a/tests/misc-tests/074-inspect-internal-inode-resolve/test.sh b/tests/misc-tests/074-inspect-internal-inode-resolve/test.sh
+index 22ace0ca..0e46e4b8 100755
+--- a/tests/misc-tests/074-inspect-internal-inode-resolve/test.sh
++++ b/tests/misc-tests/074-inspect-internal-inode-resolve/test.sh
+@@ -12,9 +12,10 @@ check_prereq mkfs.btrfs
+ setup_root_helper
+ prepare_test_dev
+
+-# A path of the inode that no mount reaches
+-unreachable_re='^inode [0-9]+ subvol .* path .* could not be accessed: not mounted$'
+-unreachable_ret=0
++# A path of the inode that no mount reaches is reported on stderr, and makes
++# inode-resolve exit with status 1 after printing the other paths
++unreachable_re='^ERROR: inode [0-9]+ subvol .* path .* could not be accessed: not mounted$'
++unreachable_ret=1
+
+ # Resolve inode $1 with $2 as the path argument: $3 paths must be reported
+ # as not mounted, and the printed paths must be exactly $4...
--
2.47.3
Four patches on devel 9d01fb77 (btrfs-progs Issue #400):
1. 4bd84e5a mountinfo optional fields;
-2. 2147f7bb subvolume lookup;
-3. eb127d09 inode-resolve relative to its argument (with its
- misc-tests/042 cases);
-4. da97c420 unreachable reference = error (with the misc-tests/042
- update, including its bind mount cases).
+2. 0d145ccc subvolume lookup: four routes, per path, including bind
+ mounts of directories inside the subvolume;
+3. 3f2c3c53 inode-resolve through the same routes (with the new
+ misc-tests/074-inspect-internal-inode-resolve);
+4. bed8b5eb unreachable reference or path = error (with the
+ misc-tests/042 update, including its bind mount cases, and the 074
+ update).
+
+Rows older than 2026-10-30 "bind2" ran earlier versions of patches 2-4
+(see Lane SHAs); their results are kept for the history.
Patch numbers in the tables below before 2026-10-30 "inode-resolve" are
those of the 3-patch series: their "3" is today's 4.
| test | verifies | patch(es) | last result | date | progs | harness | evidence |
|---|---|---|---|---|---|---|---|
+| `logical-resolve-repro.sh`, whole run with the previous topic (da97c420, +lr0) and this one (+lr) side by side; new layouts brename (bound /dir renamed), bdel (bound empty dir deleted, alone and with another bind), bover (/dir renamed over a bound empty dir), bcross (bind inside nested sv3 must not serve root 5), hlink/hlink2 (hard link outside the bound argument, with and without the top level mounted) | only references that were "not mounted", and partial hard-link sets, change | 2-4 | 167 paired lines: 155 identical, 12 changed: 6 "not mounted" now resolved through a bind (bind1u, brename, bdel with `$M2`: `$M5/fd`), 6 hard-link cases (hlink: `$M/fdlink` now printed, rc 0; hlink2: `path fdlink ... not mounted` on stderr, rc 1, was silently dropped; inode-resolve the same). want= lines: topic 69/69, previous 60/69, v6.14 and v7.1 3/69. bover/bdel/bcross: no path printed, "not mounted" | 2026-10-30 | v6.14, v7.1, da97c420, bed8b5eb | ec655bda | `bind2/run-ahive-bind2-bed8b5eb.txt`, `bind2/repro-diff-lr0-vs-lr-bed8b5eb.txt` |
+| misc-tests 074-inspect-internal-inode-resolve (patch 3, updated by 4): vol mounted subvol=/vol; the subvolume root, a directory in it, "." in it, a bind of idir and a directory in it; then links in ldir and at the root: from the root all three, from the bind of idir the others through the mount of vol; with vol unmounted and binds of idir and ldir, ldir/link through the bind of ldir and the root link not mounted | exact path set, number of not-mounted paths, exit status | 3, 4 | PASS at 3f2c3c53 (10 runs, rc 0: patch 3 prints the message on stdout) and at bed8b5eb and testing a32d9351 (10 runs, 2 with rc 1). Control: the da97c420 binary FAILS (`$TEST_MNT/ldir/link`, `$TEST_MNT/link` not printed from the bind) | 2026-10-30 | 3f2c3c53, bed8b5eb, testing a32d9351 | ec655bda | `bind2/misc-074-*.txt` |
+| misc-tests 042, bind section, new case: argument mnt5 (bind of a directory of subvol2), file3 of vol1 reached through the bind of its directory as `$PWD/mnt4/file3` | route 4 | 2, 4 | PASS at bed8b5eb and testing a32d9351. Control: the da97c420 binary FAILS at it | 2026-10-30 | bed8b5eb, a32d9351 | ec655bda | `bind2/misc-042-*.txt` |
+| bisect: misc-tests 042 at each patch, 074 at patches 3 and 4 | each patch builds and passes its tests | 1-4 | PASS at 4bd84e5a, 0d145ccc, 3f2c3c53, bed8b5eb | 2026-10-30 | each | ec655bda | `bind2/progs-tests-ahive-bisect-and-testing.txt` |
| `logical-resolve-repro.sh` ir-* (inode-resolve with the argument the subvolume root, a directory inside it, "." in it, the bind of /dir, the bind of sv1/sv2/d2; ir-hlink: a second hard link outside the bind) | the existing path relative to the argument is printed; names outside the argument are an error with rc 1 | 3 | topic 10/10 ok. v6.14 and stock v7.1: 3/10 each (only the subvolume-root arguments); otherwise they print a nonexistent path repeating the argument's part, e.g. `$M/dir/dir/fd`, `$M6/d2/fd2`, and with the hard link two nonexistent paths, rc 0 | 2026-10-30 | v6.14, v7.1, topic da97c420 | b2dbbe5a | `run-ahive-ir-da97c420.txt` |
-| misc-tests 042 inode-resolve cases (patch 3): `$TEST_MNT` (vol1 root), `$TEST_MNT/idir`, "." in idir, a bind of idir at mnt6 and mnt6/sub; then a second link outside idir: both names from the root, rc 1 + the error from mnt6 and idir/sub | exact path set, exit status, error message | 3 | PASS (8 inode-resolve runs, 2 with rc 1), also on patch 3 alone (eb127d09). Control: the same test with cmds/inspect.c of 6b5d8220 FAILS at `inode-resolve 264 .../mnt/idir printed '.../mnt/idir/idir/sub/ifile'` | 2026-10-30 | eb127d09, topic da97c420, testing 14c065a7 | b2dbbe5a, 237fbdd2 | `misc-042-results-{patch3-eb127d09,topic-da97c420,testing-14c065a7}.txt` |
+| (superseded by 074 in "bind2") misc-tests 042 inode-resolve cases (patch 3): `$TEST_MNT` (vol1 root), `$TEST_MNT/idir`, "." in idir, a bind of idir at mnt6 and mnt6/sub; then a second link outside idir: both names from the root, rc 1 + the error from mnt6 and idir/sub | exact path set, exit status, error message | 3 | PASS (8 inode-resolve runs, 2 with rc 1), also on patch 3 alone (eb127d09). Control: the same test with cmds/inspect.c of 6b5d8220 FAILS at `inode-resolve 264 .../mnt/idir printed '.../mnt/idir/idir/sub/ifile'` | 2026-10-30 | eb127d09, topic da97c420, testing 14c065a7 | b2dbbe5a, 237fbdd2 | `misc-042-results-{patch3-eb127d09,topic-da97c420,testing-14c065a7}.txt` |
| `logical-resolve-repro.sh` bind1u with the unrelated subvol=/sv1 mount `$M2` as the argument | a nested subvolume below a bind of a non-subvolume directory resolves through the mount route | 2 | topic: `dir/sub/sv3/f3` -> `$M5/sub/sv3/f3` 2/2 ok (stock "not mounted"). `dir/fd` (its subvolume reachable only through the bind of its own directory): "not mounted", rc 1, the known gap below (stock `ino paths ioctl: No such file or directory`) | 2026-10-30 | v6.14, v7.1, topic da97c420 | b2dbbe5a | `run-ahive-ir-da97c420.txt` |
| `logical-resolve-repro.sh`, bind mount layouts (bind1/bind1u: the bind of the non-subvolume directory /dir is the only way in, alone or with an unrelated subvol=/sv1 mount, argument the bind point and the directory above the nested subvolume; bind2/bind2t: argument inside that bind (".", $PWD, relative, absolute, a directory in it) for a file of the same subvolume and of a nested one, without and with the top level also mounted; bind3: bind of a directory of the nested subvolume sv1/sv2 as the argument and only way in), each checking one expected path | the expected path relative to the argument is printed | 2 | topic: 36/36 ok (again on da97c420). v6.14 and stock v7.1: 0/36 (same-subvolume files get a nonexistent path such as `./dir/fd`: the old root-5 shortcut; nested ones are "not mounted"). Topic before the fix (4ba66afa): bind1, bind1u and the nested-subvolume bind2 cases ok; the same-subvolume bind2/bind2t cases (`./fd` printed via the other mount or "not mounted", rc 1) and bind3 (rc 1) MISSING. All non-bind lines identical to the 4ba66afa run | 2026-10-30 | v6.14, v7.1, testing 4ba66afa and df38fbfe (6b5d8220 has the same binary) | see Lane SHAs | `run-ahive-bind-testing-4ba66afa.txt`, `run-ahive-testing-df38fbfe.txt` |
| misc-tests 042 bind mount cases (patch 3): vol1's directory bdir bound at mnt4 and subvol2's directory d2 at mnt5, `$TEST_MNT` unmounted; file3 (vol1, in bdir), file4 (subvol2 nested below bdir), file5 (subvol2, in d2), argument the bind point, a directory in it, "." and an absolute path; the expected path must be printed | 2, 3 | PASS (26 path lines, 4 unreachable references as before). Control: the same test with the 4ba66afa binary FAILS at `logical-resolve 13631488 mnt4 did not print mnt4/file3`; with stock v7.1 it fails earlier, as before | 2026-10-30 | testing df38fbfe, 6b5d8220 | see Lane SHAs | `misc-042-results-testing-{df38fbfe,6b5d8220}.txt`, `progs-tests-ahive-testing-df38fbfe.txt` |
| misc-tests 024-inspect-internal-rootid, 013-subvolume-sync-crash, 040-subvolume-delete-default, 043-subvolume-set-default-toplevel, 055-qgroup-clear-stale | PASS (rc 0 each) | 2026-10-30 | testing 25b77be8 | `progs-tests-ahive-testing-25b77be8.txt` |
| cli-tests 008-subvolume-get-set-default | PASS | 2026-10-30 | testing 25b77be8 | same |
| misc 042, 024, 013, 040, 043, 055, cli 008, with patch 3 | PASS | 2026-10-30 | topic da97c420, testing 14c065a7 | `progs-tests-ahive-{topic-da97c420,testing-14c065a7}.txt` |
+| misc 042, 074, 024, 013, 040, 043, 055, cli 008 ("bind2") | PASS | 2026-10-30 | topic bed8b5eb, testing a32d9351 | `bind2/progs-tests-ahive-bisect-and-testing.txt` |
`make testsuite` was not built on ahive at the time (fsstress needs
liburing, which ahive did not have); `make all` and `TEST=...
## Lane SHAs
+- 2026-10-30 "bind2" (Zygo: implement the non-root-bind route in patch 2;
+ report hard links outside the argument only if no route reaches them,
+ inode-resolve too; inode-resolve cases into a new misc test): 2147f7bb
+ -> 0d145ccc (one resolver: routes 1-4 per path, `subvol_path_of_fd()`
+ moves here, deleted directories skipped by link count), eb127d09 ->
+ 3f2c3c53 (inode-resolve uses the resolver; misc-tests/074 replaces its
+ 042 cases), da97c420 -> bed8b5eb (two more messages to stderr, 042
+ route-4 case, 074 update). Authors, committers and dates kept. testing
+ 14c065a7 -> a32d9351, same parents; tree = 14c065a7's + exactly the
+ topic diff = a real octopus merge. Backups refs/backup/progs-20261030-bind2/.
- 2026-10-30 inode-resolve (Zygo: "do fix #1"): new patch 3 eb127d09
(Fixes 6055e736045d) after the subvolume lookup patch, whose helpers it
uses (`ino_to_path_fd_below()` gains a skipped count; the INO_LOOKUP
BTRFS_ASSERT). Evidence: raid56-wh-harness
`forensics/progs-testsuite-20261030/SUMMARY.md` (harness b243013).
-3bc81a49 differs from the current `testing` 14c065a7 in four ways,
+3bc81a49 differs from the current `testing` a32d9351 in four ways,
all in logical-resolve-fixes: it still had the arg_strtou64() hex patch
that was since dropped, and the collapsed misc-tests/042 line that was
since restored; and it predates the fix for a path argument inside a
subvolume (e.g. a bind-mounted directory) and the bind mount cases of
-misc-tests/042 (2026-10-30); and it predates the inode-resolve patch.
+misc-tests/042 (2026-10-30); and it predates the inode-resolve patch, misc-tests/074 and the bind mount route.
| suite | pass | not run | fail |
|---|---|---|---|
on purpose); use decimal or `$((0x...))`.
- `-o` has no separate defect on devel: it resolves exactly what the
plain command resolves in every case.
-- Bind mounts: the argument route works through them (tables above).
- The mount route also uses a bind of a directory that is an ancestor of
- the subvolume (bind1u with `$M2` as the argument). It still does not
- use a bind of a directory inside a subvolume as that subvolume's mount
- (wrongfs layout: `/sv1/bdir` mounted first is skipped; bind1u `dir/fd`),
- so with the argument elsewhere a subvolume reachable only through such
- a bind is reported unreachable (stderr, rc 1).
-- logical-resolve with an argument inside the subvolume prints only the
- inode's names below the argument; other hard links outside it are
- skipped without a message, rc 0 (repro hlink layout). inode-resolve
- reports the same case since patch 3.
+- Bind mounts of directories inside a subvolume are used for the paths
+ below them only, never as the mount of the whole subvolume (wrongfs:
+ `/sv1/bdir` mounted first still loses to the subvol=/sv1 mount).
+- Mount points with escaped characters in mountinfo (`\040` for a space)
+ are not unescaped by iterate_btrfs_mounts(), so those mounts are not
+ used by any mount route (pre-existing, not changed).
+- The paths of one inode come from one INO_PATHS call of PATH_MAX bytes,
+ as before; an inode with more names than fit loses the rest silently
+ (pre-existing).
- Upstream misc-tests/042 before this series has two bind mounts (of
`$TEST_MNT/dir`, an empty directory, and of the whole `$TEST_MNT`), but
neither is the only way to any file and nothing checks which path is
BTRFS_ASSERT). Evidence: raid56-wh-harness
`forensics/progs-testsuite-20261030/SUMMARY.md` (harness b243013).
-3bc81a49 differs from the current `testing` 14c065a7 in four ways,
+3bc81a49 differs from the current `testing` a32d9351 in four ways,
all in logical-resolve-fixes: it still had the arg_strtou64() hex patch
that was since dropped, and the collapsed misc-tests/042 line that was
since restored; and it predates the fix for a path argument inside a
subvolume (e.g. a bind-mounted directory) and the bind mount cases of
-misc-tests/042 (2026-10-30); and it predates the inode-resolve patch.
+misc-tests/042 (2026-10-30); and it predates the inode-resolve patch, misc-tests/074 and the bind mount route.
| suite | pass | not run | fail |
|---|---|---|---|
BTRFS_ASSERT). Evidence: raid56-wh-harness
`forensics/progs-testsuite-20261030/SUMMARY.md` (harness b243013).
-3bc81a49 differs from the current `testing` 14c065a7 in four ways,
+3bc81a49 differs from the current `testing` a32d9351 in four ways,
all in logical-resolve-fixes: it still had the arg_strtou64() hex patch
that was since dropped, and the collapsed misc-tests/042 line that was
since restored; and it predates the fix for a path argument inside a
subvolume (e.g. a bind-mounted directory) and the bind mount cases of
-misc-tests/042 (2026-10-30); and it predates the inode-resolve patch.
+misc-tests/042 (2026-10-30); and it predates the inode-resolve patch, misc-tests/074 and the bind mount route.
| suite | pass | not run | fail |
|---|---|---|---|
From c6bdae69281400698579562f59ef003b323cf7f6 Mon Sep 17 00:00:00 2001
From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Fri, 30 Oct 2026 17:30:53 -0400
+Date: Fri, 30 Oct 2026 18:58:57 -0400
Subject: [PATCH 0/2] btrfs-progs: scrub: leave the device limits alone without --limit
To: linux-btrfs@vger.kernel.org
BTRFS_ASSERT). Evidence: raid56-wh-harness
`forensics/progs-testsuite-20261030/SUMMARY.md` (harness b243013).
-3bc81a49 differs from the current `testing` 14c065a7 in four ways,
+3bc81a49 differs from the current `testing` a32d9351 in four ways,
all in logical-resolve-fixes: it still had the arg_strtou64() hex patch
that was since dropped, and the collapsed misc-tests/042 line that was
since restored; and it predates the fix for a path argument inside a
subvolume (e.g. a bind-mounted directory) and the bind mount cases of
-misc-tests/042 (2026-10-30); and it predates the inode-resolve patch.
+misc-tests/042 (2026-10-30); and it predates the inode-resolve patch, misc-tests/074 and the bind mount route.
| suite | pass | not run | fail |
|---|---|---|---|
From 37cc6ecb63f75d08913183387116f1ea7ecc05e0 Mon Sep 17 00:00:00 2001
From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Fri, 30 Oct 2026 17:30:53 -0400
+Date: Fri, 30 Oct 2026 18:58:57 -0400
Subject: [PATCH 0/2] btrfs-progs: scrub: progress socket fixes
To: linux-btrfs@vger.kernel.org
BTRFS_ASSERT). Evidence: raid56-wh-harness
`forensics/progs-testsuite-20261030/SUMMARY.md` (harness b243013).
-3bc81a49 differs from the current `testing` 14c065a7 in four ways,
+3bc81a49 differs from the current `testing` a32d9351 in four ways,
all in logical-resolve-fixes: it still had the arg_strtou64() hex patch
that was since dropped, and the collapsed misc-tests/042 line that was
since restored; and it predates the fix for a path argument inside a
subvolume (e.g. a bind-mounted directory) and the bind mount cases of
-misc-tests/042 (2026-10-30); and it predates the inode-resolve patch.
+misc-tests/042 (2026-10-30); and it predates the inode-resolve patch, misc-tests/074 and the bind mount route.
| suite | pass | not run | fail |
|---|---|---|---|