Some fixes to make failures in ddf get handled properly.
This commit is contained in:
parent
80d26cb2fd
commit
57632f4afb
10
monitor.c
10
monitor.c
|
@ -225,7 +225,7 @@ static int read_and_act(struct active_array *a)
|
|||
a->curr_action = read_action(a->action_fd);
|
||||
for (mdi = a->info.devs; mdi ; mdi = mdi->next) {
|
||||
mdi->next_state = 0;
|
||||
if (mdi->state_fd > 0)
|
||||
if (mdi->state_fd >= 0)
|
||||
mdi->curr_state = read_dev_state(mdi->state_fd);
|
||||
}
|
||||
|
||||
|
@ -307,16 +307,16 @@ static int read_and_act(struct active_array *a)
|
|||
if (a->next_action != bad_action)
|
||||
write_attr(sync_actions[a->next_action], a->action_fd);
|
||||
for (mdi = a->info.devs; mdi ; mdi = mdi->next) {
|
||||
if (mdi->next_state == DS_REMOVE && mdi->state_fd > 0) {
|
||||
int remove_err;
|
||||
if (mdi->next_state == DS_REMOVE && mdi->state_fd >= 0) {
|
||||
int remove_result;
|
||||
|
||||
write_attr("-blocked", mdi->state_fd);
|
||||
/* the kernel may not be able to immediately remove the
|
||||
* disk, we can simply wait until the next event to try
|
||||
* again.
|
||||
*/
|
||||
remove_err = write_attr("remove", mdi->state_fd);
|
||||
if (!remove_err) {
|
||||
remove_result = write_attr("remove", mdi->state_fd);
|
||||
if (remove_result > 0) {
|
||||
close(mdi->state_fd);
|
||||
mdi->state_fd = -1;
|
||||
}
|
||||
|
|
|
@ -2664,8 +2664,8 @@ static void ddf_set_disk(struct active_array *a, int n, int state)
|
|||
pd = find_phys(ddf, vc->phys_refnum[i]);
|
||||
if (pd < 0)
|
||||
continue;
|
||||
st = ddf->phys->entries[pd].state;
|
||||
if ((state & (DDF_Online|DDF_Failed|DDF_Rebuilding))
|
||||
st = __be16_to_cpu(ddf->phys->entries[pd].state);
|
||||
if ((st & (DDF_Online|DDF_Failed|DDF_Rebuilding))
|
||||
== DDF_Online)
|
||||
working++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue