summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-08-19 17:55:15 +1000
committerNeilBrown <neilb@suse.de>2008-08-19 17:55:15 +1000
commite9dd159873cfa0da1ec3e4f173c24f330ea526f8 (patch)
treef95abf6b0736b9f7a0bd3743d037bc8f3f7b793d /monitor.c
parent3c558363a1991430e8a9e10c93ee9ee3f8996940 (diff)
Allow an externally managed array to be marked readonly
If the metadata_version is -mdXXX/whatever rather than /mdXXX/whatever then the array is readonly and should be left alone by mdmon. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/monitor.c b/monitor.c
index 900cba3c..45b5d5b5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -238,15 +238,21 @@ static int read_and_act(struct active_array *a)
}
if (a->curr_state == readonly) {
- /* Well, I'm ready to handle things, so
- * read-auto is OK. FIXME what if we really want
- * readonly ???
+ /* Well, I'm ready to handle things. If readonly
+ * wasn't requested, transition to read-auto.
*/
- get_resync_start(a);
- if (a->container->ss->set_array_state(a, 2))
- a->next_state = read_auto; /* array is clean */
- else
- a->next_state = active; /* Now active for recovery etc */
+ char buf[64];
+ read_attr(buf, sizeof(buf), a->metadata_fd);
+ if (strncmp(buf, "external:-", 10) == 0) {
+ /* explicit request for readonly array. Leave it alone */
+ ;
+ } else {
+ get_resync_start(a);
+ if (a->container->ss->set_array_state(a, 2))
+ a->next_state = read_auto; /* array is clean */
+ else
+ a->next_state = active; /* Now active for recovery etc */
+ }
}
if (!deactivate &&