/* * NAME: check_4_hs * * DESCRIPTION: Check every component of every raid unit for any device which * needs to be backed with a hot spare. * * PARAMETERS: daemon_request_t *dr - hotspare request daemon * * LOCKS: Acquires and releases the Hotspare Request Lock and the RAID * Driver Lock. Acquires the Unit Writer Lock which is released * in check_comp_4_hs. */ static void check_4_hs(daemon_request_t *dr) { mdi_unit_t *ui; mr_unit_t *un; md_link_t *next; int i; mutex_enter(&dr->dr_mx); /* clear up front so can poke */ dr->dr_pending = 0; /* again in low level routine if */ mutex_exit(&dr->dr_mx); /* something found to do */ /* * Scan raid unit list and call component hotspare check routine for * each component of each unit where resync is inactive. */ rw_enter(&raid_md_ops.md_link_rw.lock, RW_READER); for (next = raid_md_ops.md_head; next != NULL; next = next->ln_next) { ui = MDI_UNIT(next->ln_id); un = (mr_unit_t *)md_unit_readerlock(ui); if (!(un->c.un_status & MD_UN_RESYNC_ACTIVE) && (raid_state_cnt(un, RCS_RESYNC) == 0) && (UNIT_STATE(un) & RUS_ERRED) && (un->un_hsp_id != -1) && (raid_state_cnt(un, RCS_ERRED) == 1)) { for (i = 0; i < un->un_totalcolumncnt; i++) if (un->un_column[i].un_devstate == RCS_ERRED) check_comp_4_hs(un, i); } md_unit_readerexit(ui); } rw_exit(&raid_md_ops.md_link_rw.lock); }
/* * NAMES: raid_replay_error * DESCRIPTION: RAID metadevice replay error handling routine (TBD) * PARAMETERS: * RETURNS: */ static int raid_replay_error(mr_unit_t *un, int column) { int error = RAID_RPLY_COMPREPLAY; raid_set_state(un, column, RCS_ERRED, 0); raid_commit(un, NULL); if (UNIT_STATE(un) == RUS_LAST_ERRED) { error = RAID_RPLY_READONLY; SE_NOTIFY(EC_SVM_STATE, ESC_SVM_LASTERRED, SVM_TAG_METADEVICE, MD_UN2SET(un), MD_SID(un)); } else if (UNIT_STATE(un) == RUS_ERRED) { SE_NOTIFY(EC_SVM_STATE, ESC_SVM_ERRED, SVM_TAG_METADEVICE, MD_UN2SET(un), MD_SID(un)); } return (error); }