aboutsummaryrefslogtreecommitdiff
path: root/lib/libspl
diff options
context:
space:
mode:
authorPrakash Surya <prakash.surya@perforce.com>2026-04-28 16:24:24 +0000
committerGitHub <noreply@github.com>2026-04-28 16:24:24 +0000
commit4acb62930b72e4ee5675b58aaecd6101351b324e (patch)
treef07dc5ff9234e2ee2b643831777989e3fba9a4b9 /lib/libspl
parentcd06f79e2949b6255f5e8bf621c1b9497ad97b02 (diff)
Diffstat (limited to 'lib/libspl')
-rw-r--r--lib/libspl/os/linux/mnttab.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libspl/os/linux/mnttab.c b/lib/libspl/os/linux/mnttab.c
index 25fa132ac6fc..f51219e898e6 100644
--- a/lib/libspl/os/linux/mnttab.c
+++ b/lib/libspl/os/linux/mnttab.c
@@ -125,7 +125,14 @@ getextmntent(const char *path, struct mnttab *entry, struct stat64 *statbuf)
}
#ifdef HAVE_STATX_MNT_ID
- if (statx(AT_FDCWD, path, AT_STATX_SYNC_AS_STAT | AT_SYMLINK_NOFOLLOW,
+ /*
+ * Use AT_STATX_SYNC_AS_STAT without AT_SYMLINK_NOFOLLOW so that
+ * symlinks are followed, matching the behavior of stat64() above.
+ * Without this, if path is a symlink crossing a mount boundary,
+ * statx() returns the mnt_id of the symlink's location rather
+ * than the symlink target's mount.
+ */
+ if (statx(AT_FDCWD, path, AT_STATX_SYNC_AS_STAT,
STATX_MNT_ID, &stx) == 0 && (stx.stx_mask & STATX_MNT_ID)) {
have_mnt_id = B_TRUE;
target_mnt_id = stx.stx_mnt_id;