summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason King <jason.king@joyent.com>2020-01-31 13:21:59 -0600
committerJason King <jason.king@joyent.com>2020-02-03 18:01:07 -0600
commit8b06eaf6acc31eaadddc0fec3df9d1a4294b7cc2 (patch)
tree3e9b2ecc88bb660d95bc4da7f178a5faab40fa20
parenta52121ea720d327228a95e9d0c4a426339f08c7f (diff)
downloadillumos-joyent-8b06eaf6acc31eaadddc0fec3df9d1a4294b7cc2.tar.gz
12267 zfs '::abuf_find' dcmd is broken
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Kody Kantor <kody@kkantor.com> Reviewed by: Igor Kozhukhov <igor@dilos.org> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/cmd/mdb/common/modules/zfs/zfs.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/usr/src/cmd/mdb/common/modules/zfs/zfs.c b/usr/src/cmd/mdb/common/modules/zfs/zfs.c
index 431dce10b3..05caf276cd 100644
--- a/usr/src/cmd/mdb/common/modules/zfs/zfs.c
+++ b/usr/src/cmd/mdb/common/modules/zfs/zfs.c
@@ -1006,13 +1006,17 @@ abuf_find_cb(uintptr_t addr, const void *unknown, void *arg)
return (WALK_NEXT);
}
+typedef struct mdb_arc_state {
+ uintptr_t arcs_list[ARC_BUFC_NUMTYPES];
+} mdb_arc_state_t;
+
/* ARGSUSED */
static int
abuf_find(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
abuf_find_data_t data;
GElf_Sym sym;
- int i;
+ int i, j;
const char *syms[] = {
"ARC_mru",
"ARC_mru_ghost",
@@ -1042,15 +1046,31 @@ abuf_find(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}
for (i = 0; i < sizeof (syms) / sizeof (syms[0]); i++) {
+ mdb_arc_state_t mas;
+
if (mdb_lookup_by_obj(ZFS_OBJ_NAME, syms[i], &sym)) {
mdb_warn("can't find symbol %s", syms[i]);
return (DCMD_ERR);
}
- if (mdb_pwalk("list", abuf_find_cb, &data, sym.st_value) != 0) {
- mdb_warn("can't walk %s", syms[i]);
+ if (mdb_ctf_vread(&mas, "arc_state_t", "mdb_arc_state_t",
+ sym.st_value, 0) != 0) {
+ mdb_warn("can't read arcs_list of %s", syms[i]);
return (DCMD_ERR);
}
+
+ for (j = 0; j < ARC_BUFC_NUMTYPES; j++) {
+ uintptr_t addr = mas.arcs_list[j];
+
+ if (addr == 0)
+ continue;
+
+ if (mdb_pwalk("multilist", abuf_find_cb, &data,
+ addr) != 0) {
+ mdb_warn("can't walk %s", syms[i]);
+ return (DCMD_ERR);
+ }
+ }
}
return (DCMD_OK);