diff options
| author | Askar Safin <safinaskar@zohomail.com> | 2025-08-25 18:12:30 +0000 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-09-02 10:40:42 +0200 |
| commit | 11c2b7ec2e1865bbc6a65e7d7312a5043e3cc1aa (patch) | |
| tree | de699f520b049381627bbd000382ed1e68511a26 /fs/namei.c | |
| parent | 7f9d34b0a7cb93d678ee7207f0634dbf79e47fe5 (diff) | |
namei: move cross-device check to traverse_mounts
This is preparation to RESOLVE_NO_XDEV fix in following commits.
No functional change intended
Signed-off-by: Askar Safin <safinaskar@zohomail.com>
Link: https://lore.kernel.org/20250825181233.2464822-2-safinaskar@zohomail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/namei.c')
| -rw-r--r-- | fs/namei.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c index 138a693c2346..f81fdc7bbfed 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1518,6 +1518,7 @@ static inline int traverse_mounts(struct path *path, bool *jumped, int *count, unsigned lookup_flags) { unsigned flags = smp_load_acquire(&path->dentry->d_flags); + int ret; /* fastpath */ if (likely(!(flags & DCACHE_MANAGED_DENTRY))) { @@ -1526,7 +1527,11 @@ static inline int traverse_mounts(struct path *path, bool *jumped, return -ENOENT; return 0; } - return __traverse_mounts(path, flags, jumped, count, lookup_flags); + + ret = __traverse_mounts(path, flags, jumped, count, lookup_flags); + if (*jumped && unlikely(lookup_flags & LOOKUP_NO_XDEV)) + return -EXDEV; + return ret; } int follow_down_one(struct path *path) @@ -1631,9 +1636,7 @@ static inline int handle_mounts(struct nameidata *nd, struct dentry *dentry, } ret = traverse_mounts(path, &jumped, &nd->total_link_count, nd->flags); if (jumped) { - if (unlikely(nd->flags & LOOKUP_NO_XDEV)) - ret = -EXDEV; - else + if (!unlikely(nd->flags & LOOKUP_NO_XDEV)) nd->state |= ND_JUMPED; } if (unlikely(ret)) { |
