svn commit: r217912 - projects/graid/head/sys/geom/raid
Warner Losh
imp at FreeBSD.org
Wed Jan 26 21:22:07 UTC 2011
Author: imp
Date: Wed Jan 26 21:22:06 2011
New Revision: 217912
URL: http://svn.freebsd.org/changeset/base/217912
Log:
Guard against the case where we don't have an extra disk to rebuild.
Modified:
projects/graid/head/sys/geom/raid/tr_raid1.c
Modified: projects/graid/head/sys/geom/raid/tr_raid1.c
==============================================================================
--- projects/graid/head/sys/geom/raid/tr_raid1.c Wed Jan 26 21:14:20 2011 (r217911)
+++ projects/graid/head/sys/geom/raid/tr_raid1.c Wed Jan 26 21:22:06 2011 (r217912)
@@ -66,12 +66,12 @@ struct g_raid_tr_raid1_object {
struct g_raid_tr_object trso_base;
int trso_starting;
int trso_stopped;
- int trso_type; /* From here down */
- int trso_recover_slabs; /* might need to be more */
+ int trso_type;
+ int trso_recover_slabs; /* might need to be more */
int trso_fair_io;
- struct g_raid_subdisk *trso_good_sd; /* specific rather than per tr */
- struct g_raid_subdisk *trso_failed_sd; /* like per volume */
- void *trso_buffer; /* Buffer space */
+ struct g_raid_subdisk *trso_good_sd; /* specific rather than per tr */
+ struct g_raid_subdisk *trso_failed_sd;/* like per volume */
+ void *trso_buffer; /* Buffer space */
};
static g_raid_tr_taste_t g_raid_tr_taste_raid1;
@@ -153,6 +153,8 @@ g_raid_tr_raid1_idle_rebuild(struct g_ra
struct g_raid_tr_raid1_object *trs;
trs = (struct g_raid_tr_raid1_object *)argp;
+ if (trs->trso_good_sd == NULL || trs->trso_failed_sd == NULL)
+ return;
g_raid_event_send(trs->trso_failed_sd, G_RAID_SUBDISK_E_TR_REBUILD_SOME,
G_RAID_EVENT_SUBDISK);
}
@@ -223,6 +225,12 @@ g_raid_tr_raid1_rebuild_start(struct g_r
}
trs->trso_good_sd = g_raid_tr_raid1_find_good_drive(vol);
trs->trso_failed_sd = g_raid_tr_raid1_find_failed_drive(vol);
+ if (trs->trso_good_sd == NULL || trs->trso_failed_sd == NULL) {
+ G_RAID_DEBUG(1, "No failed disk to rebuild. night night.");
+ return;
+ }
+ G_RAID_DEBUG(2, "Kicking off a rebuild...");
+ trs->trso_type = TR_RAID1_REBUILD;
trs->trso_failed_sd->sd_rebuild_pos = 0;
trs->trso_buffer = malloc(SD_REBUILD_SLAB, M_TR_raid1, M_WAITOK);
/* XXX what else do I need to setup the first time? */
More information about the svn-src-projects
mailing list