]> git.ipfire.org Git - thirdparty/mdadm.git/commit - Manage.c
Enhance incremental removal.
authorNeilBrown <neilb@suse.de>
Mon, 4 Mar 2013 22:46:34 +0000 (09:46 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 4 Mar 2013 22:46:34 +0000 (09:46 +1100)
commit8af530b07fce27f56c56b2ffd254a40b4ab67c6b
tree618f49d47873ac20fea4cbe24bcc8dc16e23ec48
parent401f095c39b732b4247bd728cb493eb7bb692298
Enhance incremental removal.

When asked to incrementally-remove a device, try marking the array
read-auto first.  That will delay recording the failure in the
metadata until it is really relevant.
This way, if the device are just unplugged when the array is not
really in use, the metadata will remain clean.

If marking the default as faulty fails because it is EBUSY, that
implies that the array would be failed without the device.  As the
device has (presumably gone) - that means the array is dead.  So try
to stop it.  If that fails because it is in use, send a uevent to
report that it is gone.  Hopefully whoever mounted it will now let go.

This means that if  you plug in some devices and they are
auto-assembled, then unplugging them will auto-deassemble relatively
cleanly.

To be complete, we really need the kernel to disassemble the array
after the last close somehow.  Maybe if a REMOVE has failed and a STOP
has failed and nothing else much has happened, it could safely stop
the array on last close.

Signed-off-by: NeilBrown <neilb@suse.de>
Incremental.c
Manage.c