md: remove unneeded sysfs files more promptly
commit82f2fa7b6f147ab16273f052a85c9ccb628d055d
authorNeilBrown <neilb@suse.de>
Thu, 15 Apr 2010 00:13:47 +0000 (15 10:13 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:22:23 +0000 (5 11:22 -0700)
tree26ebc6b468bfdac57e38c69d8f3a1acd7f7f5c71
parent784400c5bf5ded58e79d935e9d2ddc989ba4fb30
md: remove unneeded sysfs files more promptly

commit b6eb127d274385d81ce8dd45c98190f097bce1b4 upstream.

When an array is stopped we need to remove some
sysfs files which are dependent on the type of array.

We need to delay that deletion as deleting them while holding
reconfig_mutex can lead to deadlocks.

We currently delay them until the array is completely destroyed.
However it is possible to deactivate and then reactivate the array.
It is also possible to need to remove sysfs files when changing level,
which can potentially happen several times before an array is
destroyed.

So we need to delete these files more promptly: as soon as
reconfig_mutex is dropped.

We need to ensure this happens before do_md_run can restart the array,
so we use open_mutex for some extra locking.  This is not deadlock
prone.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/md.c