summaryrefslogtreecommitdiffstats
path: root/monitor.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-05-15 16:48:44 +1000
committerNeil Brown <neilb@suse.de>2008-05-15 16:48:44 +1000
commit2a0bb19e0089aef4fcc65513c40a54cb00e53a7b (patch)
treebcd5731d93f1f5067cd6b8374c6dc2a79cd57fbd /monitor.c
parentfd7cde1bf0221049b6359a96ab4c43578897d0ab (diff)
downloadmdadm-2a0bb19e0089aef4fcc65513c40a54cb00e53a7b.tar.gz
mdadm-2a0bb19e0089aef4fcc65513c40a54cb00e53a7b.tar.xz
mdadm-2a0bb19e0089aef4fcc65513c40a54cb00e53a7b.zip
Flag arrays for deletion after they have been stopped.
From: Dan Williams <dan.j.williams@intel.com> If they are later reassembled they will be replaced and deallocated via replace_array. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index ee35bdf..9e98aeb 100644
--- a/monitor.c
+++ b/monitor.c
@@ -228,6 +228,7 @@ int read_dev_state(int fd)
static int read_and_act(struct active_array *a)
{
int check_degraded;
+ int deactivate = 0;
struct mdinfo *mdi;
a->next_state = bad_word;
@@ -246,6 +247,7 @@ static int read_and_act(struct active_array *a)
get_sync_pos(a);
a->container->ss->mark_clean(a, a->sync_pos);
a->next_state = clear;
+ deactivate = 1;
}
if (a->curr_state == write_pending) {
a->container->ss->mark_dirty(a);
@@ -326,6 +328,9 @@ static int read_and_act(struct active_array *a)
mdi->next_state = 0;
}
+ if (deactivate)
+ a->container = NULL;
+
return 1;
}
@@ -342,6 +347,12 @@ static int wait_and_act(struct active_array *aa, int pfd, int nowait)
for (a = aa ; a ; a = a->next) {
struct mdinfo *mdi;
+ /* once an array has been deactivated only the manager
+ * thread can make us care about it again
+ */
+ if (!a->container)
+ continue;
+
add_fd(&rfds, &maxfd, a->info.state_fd);
add_fd(&rfds, &maxfd, a->action_fd);
for (mdi = a->info.devs ; mdi ; mdi = mdi->next)
@@ -362,7 +373,7 @@ static int wait_and_act(struct active_array *aa, int pfd, int nowait)
}
for (a = aa; a ; a = a->next) {
- if (a->replaces) {
+ if (a->replaces && !discard_this) {
struct active_array **ap;
for (ap = &a->next; *ap && *ap != a->replaces;
ap = & (*ap)->next)
@@ -372,7 +383,8 @@ static int wait_and_act(struct active_array *aa, int pfd, int nowait)
discard_this = a->replaces;
a->replaces = NULL;
}
- rv += read_and_act(a);
+ if (a->container)
+ rv += read_and_act(a);
}
return rv;
}