Skip to content

Commit

Permalink
helpers.fs: update path_lookup() handling of mounts for Linux 6.8
Browse files Browse the repository at this point in the history
_follow_mount(), used by path_lookup(), was also affected by the
mnt_list change in 6.8. We can sidestep it by using the mount's list of
children mounts instead.

Signed-off-by: Omar Sandoval <[email protected]>
  • Loading branch information
osandov committed Feb 27, 2024
1 parent f610dc2 commit ec4a626
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drgn/helpers/linux/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
hlist_empty,
hlist_for_each_entry,
list_for_each_entry,
list_for_each_entry_reverse,
)
from drgn.helpers.linux.rbtree import rbtree_inorder_for_each_entry

Expand All @@ -45,11 +44,11 @@ def _follow_mount(mnt: Object, dentry: Object) -> Tuple[Object, Object]:
# hasn't changed since v2.6.38, so let's hardcode it for now.
DCACHE_MOUNTED = 0x10000
while dentry.d_flags & DCACHE_MOUNTED:
for mounted in list_for_each_entry_reverse(
"struct mount", mnt.mnt_ns.list.address_of_(), "mnt_list"
for mounted in list_for_each_entry(
"struct mount", mnt.mnt_mounts.address_of_(), "mnt_child"
):
if mounted.mnt_parent == mnt and mounted.mnt_mountpoint == dentry:
mnt = mounted.read_()
if mounted.mnt_mountpoint == dentry:
mnt = mounted
dentry = mounted.mnt.mnt_root.read_()
break
else:
Expand Down

0 comments on commit ec4a626

Please sign in to comment.