summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2011-07-25 09:14:36 -0700
committerBryan Cantrill <bryan@joyent.com>2011-07-25 09:14:36 -0700
commit0abb89cac47e174f1e32374258bc510e0c24529d (patch)
tree8069bdc35ca9fb87e818e83929421d4bb0707dab /usr
parent8baa7c4075e8f658e94fbefffab4b44667dbcf38 (diff)
downloadillumos-joyent-0abb89cac47e174f1e32374258bc510e0c24529d.tar.gz
HVM-507 kvmstat occasionally exits with "failed to read kstat" error
Diffstat (limited to 'usr')
-rw-r--r--usr/src/cmd/kvmstat/kvmstat.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/usr/src/cmd/kvmstat/kvmstat.c b/usr/src/cmd/kvmstat/kvmstat.c
index 3268b24ad4..526e212ef5 100644
--- a/usr/src/cmd/kvmstat/kvmstat.c
+++ b/usr/src/cmd/kvmstat/kvmstat.c
@@ -229,7 +229,21 @@ kstat_instances_read(kstat_ctl_t *kcp, kstat_instance_t *instances,
for (ksi = instances; ksi != NULL; ksi = ksi->ksi_next) {
kstat_t *ksp = ksi->ksi_ksp;
+ if (ksp == NULL)
+ continue;
+
if (kstat_read(kcp, ksp, NULL) == -1) {
+ if (errno == ENXIO) {
+ /*
+ * Our kstat has been removed since the update;
+ * NULL it out to prevent us from trying to read
+ * it again (and to indicate that it should not
+ * be displayed) and drive on.
+ */
+ ksi->ksi_ksp = NULL;
+ continue;
+ }
+
fatal("failed to read kstat %s:%d",
ksi->ksi_name, ksi->ksi_instance);
}
@@ -300,7 +314,7 @@ kstat_instances_print(kstat_instance_t *instances, kstat_field_t *fields,
}
for (ksi = instances; ksi != NULL; ksi = ksi->ksi_next) {
- if (ksi->ksi_snaptime[1] == 0)
+ if (ksi->ksi_snaptime[1] == 0 || ksi->ksi_ksp == NULL)
continue;
for (i = 0; i < nfields; i++) {