]> git.ipfire.org Git - thirdparty/mdadm.git/commit - Manage.c
Manage: fix checks for removal from a container.
authorNeilBrown <neilb@suse.de>
Mon, 24 Sep 2012 02:26:03 +0000 (12:26 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 24 Sep 2012 02:26:03 +0000 (12:26 +1000)
commitaab15415eddbfa800031cb9f6273ca8fcf59efb7
tree63ebdc4928cf9b175f59324be96bb559c5f9e514
parent65d0b4ce2d5f98081bb456c600c27a28f5f6f54f
Manage: fix checks for removal from a container.

We must only remove from a container if the device isn't a
member of any member array.
To check we look at the 'holders' directory in sysfs.

We currently skip that check if ->devname is "detached", however
that can never be true since the change that introduced
add_detached().

Also sysfs_unique_holder returns status in 'errno' which isn't
entirely safe as e.g. closedir() is probably allowed to clear it.

So make sysfs_unique_holder return an unambigious value, and us
it to decide what to report.

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