diff options
author | NeilBrown <neilb@suse.de> | 2011-12-07 23:49:12 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-12-07 23:49:12 -0500 |
commit | 1d23f178d56ae1349b4fc5108ac8f4f8cdc92afc (patch) | |
tree | 3be282873c611cab1e855e0991ee3620d4cb906b /drivers/md | |
parent | 7c8f4247986bb5c5fb1d5b1fad35461989fe8310 (diff) |
md: refine interpretation of "hold_active == UNTIL_IOCTL".
We like md devices to disappear when they really are not needed.
However it is not possible to tell from the current state whether it
is needed or not. We can only tell from recent history of changes.
In particular immediately after we create an md device it looks very
similar to immediately after we have finished with it.
So we always preserve a newly created md device until something
significant happens. This state is stored in 'hold_active'.
The normal case is to keep it until an ioctl happens, as that will
normally either activate it, or explicitly de-activate it. If it
doesn't then it was probably created by mistake and it is now time to
get rid of it.
We can also modify an array via sysfs (instead of via ioctl) and we
currently treat any change via sysfs like an ioctl as a sign that if
it now isn't more active, it should be destroyed.
However this is not appropriate as changes made via sysfs are more
gradual so we should look for a more definitive change.
So this patch only clears 'hold_active' from UNTIL_IOCTL to clear when
the array_state is changed via sysfs. Other changes via sysfs
are ignored.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 84acfe7d10e4..93b0da133507 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3788,6 +3788,8 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) | |||
3788 | if (err) | 3788 | if (err) |
3789 | return err; | 3789 | return err; |
3790 | else { | 3790 | else { |
3791 | if (mddev->hold_active == UNTIL_IOCTL) | ||
3792 | mddev->hold_active = 0; | ||
3791 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 3793 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
3792 | return len; | 3794 | return len; |
3793 | } | 3795 | } |
@@ -4508,8 +4510,6 @@ md_attr_store(struct kobject *kobj, struct attribute *attr, | |||
4508 | if (!capable(CAP_SYS_ADMIN)) | 4510 | if (!capable(CAP_SYS_ADMIN)) |
4509 | return -EACCES; | 4511 | return -EACCES; |
4510 | rv = mddev_lock(mddev); | 4512 | rv = mddev_lock(mddev); |
4511 | if (mddev->hold_active == UNTIL_IOCTL) | ||
4512 | mddev->hold_active = 0; | ||
4513 | if (!rv) { | 4513 | if (!rv) { |
4514 | rv = entry->store(mddev, page, length); | 4514 | rv = entry->store(mddev, page, length); |
4515 | mddev_unlock(mddev); | 4515 | mddev_unlock(mddev); |