diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2009-06-24 12:06:01 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2009-06-24 12:06:01 +0000 |
commit | 86f30ce80562d95ae64e9a97f24e9133161d3c3f (patch) | |
tree | 4c36e2354c933a85b118b51aa1e01f345b31b3be /sys | |
parent | 17a9c2cb31dc9e022ae56cd4a1e3d659fdf177c5 (diff) |
Abort the current rebuild if the rebuild chunk disappears. Whilst here also
rename the abort flag so that it is more generalised.
ok marco@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/softraid.c | 7 | ||||
-rw-r--r-- | sys/dev/softraid_raid1.c | 5 | ||||
-rw-r--r-- | sys/dev/softraidvar.h | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 3333f461edb..98fc0b8bfb2 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.158 2009/06/23 15:54:44 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.159 2009/06/24 12:06:00 jsing Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -2040,6 +2040,7 @@ sr_rebuild_init(struct sr_discipline *sd, dev_t dev) printf("%s: trying to rebuild %s to %s\n", DEVNAME(sc), sd->sd_meta->ssd_devname, devname); + sd->sd_reb_abort = 0; kthread_create_deferred(sr_rebuild, sd); rv = 0; @@ -2881,7 +2882,7 @@ sr_shutdown(void *arg) DEVNAME(sc), sd->sd_meta->ssd_devname); /* abort rebuild and drain io */ - sd->sd_going_down = 1; + sd->sd_reb_abort = 1; while (sd->sd_reb_active) tsleep(sd, PWAIT, "sr_shutdown", 1); @@ -3131,7 +3132,7 @@ queued: old_percent = percent; } - if (sd->sd_going_down) + if (sd->sd_reb_abort) goto abort; } diff --git a/sys/dev/softraid_raid1.c b/sys/dev/softraid_raid1.c index 5ff1e6d666f..57227846341 100644 --- a/sys/dev/softraid_raid1.c +++ b/sys/dev/softraid_raid1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid1.c,v 1.15 2009/06/18 15:55:15 jsing Exp $ */ +/* $OpenBSD: softraid_raid1.c,v 1.16 2009/06/24 12:06:00 jsing Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -163,7 +163,10 @@ sr_raid1_set_chunk_state(struct sr_discipline *sd, int c, int new_state) case BIOC_SDREBUILD: switch (new_state) { case BIOC_SDONLINE: + break; case BIOC_SDOFFLINE: + /* Abort rebuild since the rebuild chunk disappeared. */ + sd->sd_reb_abort = 1; break; default: goto die; diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h index 9bc9e5bb69a..07134bfdc24 100644 --- a/sys/dev/softraidvar.h +++ b/sys/dev/softraidvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: softraidvar.h,v 1.76 2009/06/17 22:44:42 marco Exp $ */ +/* $OpenBSD: softraidvar.h,v 1.77 2009/06/24 12:06:00 jsing Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -417,7 +417,7 @@ struct sr_discipline { u_int32_t sd_max_wu; int sd_rebuild; /* can we rebuild? */ int sd_reb_active; /* rebuild in progress */ - int sd_going_down; /* dive dive dive */ + int sd_reb_abort; /* abort rebuild */ int sd_ready; /* fully operational */ struct sr_wu_list sd_wu_freeq; /* free wu queue */ |