diff options
author | NeilBrown <neilb@suse.de> | 2008-08-19 09:55:15 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-08-19 09:55:15 +0200 |
commit | e9dd159873cfa0da1ec3e4f173c24f330ea526f8 (patch) | |
tree | f95abf6b0736b9f7a0bd3743d037bc8f3f7b793d /monitor.c | |
parent | Factor out test for subarray version string. (diff) | |
download | mdadm-e9dd159873cfa0da1ec3e4f173c24f330ea526f8.tar.xz mdadm-e9dd159873cfa0da1ec3e4f173c24f330ea526f8.zip |
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.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -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 && |