szaydel
7/18/2018 - 2:18 PM

Dtrace script for getting bits of useful information for troubleshooting EIO from sdopen

This script was added as a means of peeking into sdopen to figure out what EIOs are being returned from call when they are not expected to be there.

dtrace -qn '
  ::sdopen:entry {self->x = args[0]}
  ::ddi_get_soft_state:return /self->x/ {
    self->un = (struct sd_lun *)args[1];
  }
  ::sd_ready_and_valid:entry /self->un == args[0]->ssc_un/ {
    self->rav = 1;
  }
  ::sd_ready_and_valid:return /self->rav/ {
    self->rav = 0;
    self->isvalid = args[1];
  }
  ::cmlb_partinfo:entry /self->x/ {
      self->nblks = args[2];
      self->part = args[1];
    }
  ::cmlb_partinfo:return /self->nblks/ {
    @nblks[self->un, self->part, self->isvalid, *self->nblks] = count();
    self->nblks = 0;
    self->x = 0;
    self->part = 0;
    self->un = 0;
    self->isvalid = 0;
  }
  END {
    printa("un: %p partition: 0x%-3x isvalid: %d nblks: %-12d samples: %@d\n", @nblks);
  }'