]> git.karo-electronics.de Git - karo-tx-linux.git/commit
md: fix another deadlock with removing sysfs attributes.
authorNeilBrown <neilb@suse.de>
Sun, 8 Aug 2010 11:18:03 +0000 (21:18 +1000)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 17 Apr 2011 20:15:33 +0000 (16:15 -0400)
commit5b6ed42f7347cc8d8abcb647fd34f35bd0818843
tree6841b4febc35f46ab5c82d0f5870e9ea6f198029
parentd5cee63afcee9c14c47b7c5e0962abf2caf8d8c5
md: fix another deadlock with removing sysfs attributes.

commit bb4f1e9d0e2ef93de8e36ca0f5f26625fcd70b7d upstream.

Move the deletion of sysfs attributes from reconfig_mutex to
open_mutex didn't really help as a process can try to take
open_mutex while holding reconfig_mutex, so the same deadlock can
happen, just requiring one more process to be involved in the chain.

I looks like I cannot easily use locking to wait for the sysfs
deletion to complete, so don't.

The only things that we cannot do while the deletions are still
pending is other things which can change the sysfs namespace: run,
takeover, stop.  Each of these can fail with -EBUSY.
So set a flag while doing a sysfs deletion, and fail run, takeover,
stop if that flag is set.

This is suitable for 2.6.35.x

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/md/md.c
drivers/md/md.h