Skip to content

Commit

Permalink
Merge branch 'refs/heads/upstream-HEAD' into repo-HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Delphix Engineering committed Feb 28, 2024
2 parents 3e77eba + aaf4414 commit d809685
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/support_matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ currently fully supported are:

.. Keep this in sync with vmtest/config.py.
- 6.0-6.7
- 6.0-6.8
- 5.10-5.19
- 5.4
- 4.19
Expand Down
23 changes: 17 additions & 6 deletions drgn/helpers/linux/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
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

__all__ = (
"path_lookup",
Expand All @@ -44,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 Expand Up @@ -310,7 +310,18 @@ def for_each_mount(
dst = os.fsencode(dst)
if fstype:
fstype = os.fsencode(fstype)
for mnt in list_for_each_entry("struct mount", ns.list.address_of_(), "mnt_list"):
# Since Linux kernel commit 2eea9ce4310d ("mounts: keep list of mounts in
# an rbtree") (in v6.8), the mounts in a namespace are in a red-black tree.
# Before that, they're in a list.
# The old case is first here because before that commit, struct mount also
# had a different member named "mounts".
try:
mounts = list_for_each_entry("struct mount", ns.list.address_of_(), "mnt_list")
except AttributeError:
mounts = rbtree_inorder_for_each_entry(
"struct mount", ns.mounts.address_of_(), "mnt_node"
)
for mnt in mounts:
if (
(src is None or mount_src(mnt) == src)
and (dst is None or mount_dst(mnt) == dst)
Expand Down
1 change: 1 addition & 0 deletions vmtest/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# Kernel versions that we run tests on and therefore support. Keep this in sync
# with docs/support_matrix.rst.
SUPPORTED_KERNEL_VERSIONS = (
"6.8",
"6.7",
"6.6",
"6.5",
Expand Down

0 comments on commit d809685

Please sign in to comment.