Skip to content

Commit

Permalink
scripts/gdb: fix lx-mounts command error
Browse files Browse the repository at this point in the history
(gdb) lx-mounts
      mount          super_block     devname pathname fstype options
Python Exception <class 'gdb.error'>: There is no member named list.
Error occurred in Python: There is no member named list.

We encounter the above issue after commit 2eea9ce ("mounts: keep
list of mounts in an rbtree"). The commit move a mount from list into
rbtree.

So we can instead use rbtree to iterate all mounts information.

Link: https://lkml.kernel.org/r/20240723064902.124154-4-kuan-ying.lee@canonical.com
Fixes: 2eea9ce ("mounts: keep list of mounts in an rbtree")
Signed-off-by: Kuan-Ying Lee <kuan-ying.lee@canonical.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
kylee0215 authored and akpm00 committed Jul 29, 2024
1 parent 9139961 commit 88a1354
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/gdb/linux/proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from linux import tasks
from linux import lists
from linux import vfs
from linux import rbtree
from struct import *


Expand Down Expand Up @@ -172,8 +173,7 @@ def invoke(self, arg, from_tty):
gdb.write("{:^18} {:^15} {:>9} {} {} options\n".format(
"mount", "super_block", "devname", "pathname", "fstype"))

for mnt in lists.list_for_each_entry(namespace['list'],
mount_ptr_type, "mnt_list"):
for mnt in rbtree.rb_inorder_for_each_entry(namespace['mounts'], mount_ptr_type, "mnt_node"):
devname = mnt['mnt_devname'].string()
devname = devname if devname else "none"

Expand Down

0 comments on commit 88a1354

Please sign in to comment.