Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
mdadm.7129
0054-Remove-container-should-wait-for-an-array-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0054-Remove-container-should-wait-for-an-array-to-release.patch of Package mdadm.7129
From c922221e2522fd24f86e5a0de0bfba60b14353c0 Mon Sep 17 00:00:00 2001 From: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Date: Thu, 21 Jul 2016 09:59:42 +0200 Subject: [PATCH 282/359] Remove: container should wait for an array to release a drive References: bsc#989373 A 'faulty' drive is being removed from a container after it has been released by an array, however there is a race there. The drive is released asynchronously by a monitor but sometimes it doesn't happen before container checks it. It results in a container refusing to remove a drive as it still seems to be a part of some array. It seems 'ping_monitor' could be a solution here to assure monitor has had a chance to process the events, however it doesn't resolve the problem - sometimes an array has to request a release of the drive few times (as the array is busy) and single 'ping_monitor' call is not sufficient. As there is no way to query monitor progress, it forces us to retry a check several times before an error is returned. Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Coly Li <colyli@suse.de> --- Manage.c | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/Manage.c b/Manage.c index 30adc99..1b7b0c1 100644 --- a/Manage.c +++ b/Manage.c @@ -1125,19 +1125,34 @@ int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv, */ if (rdev == 0) ret = -1; - else - ret = sysfs_unique_holder(devnm, rdev); - if (ret == 0) { - pr_err("%s is not a member, cannot remove.\n", - dv->devname); - close(lfd); - return -1; - } - if (ret >= 2) { - pr_err("%s is still in use, cannot remove.\n", - dv->devname); - close(lfd); - return -1; + else { + /* + * The drive has already been set to 'faulty', however + * monitor might not have had time to process it and the + * drive might still have an entry in the 'holders' + * directory. Try a few times to avoid a false error + */ + int count = 20; + + do { + ret = sysfs_unique_holder(devnm, rdev); + if (ret < 2) + break; + usleep(100 * 1000); /* 100ms */ + } while (--count > 0); + + if (ret == 0) { + pr_err("%s is not a member, cannot remove.\n", + dv->devname); + close(lfd); + return -1; + } + if (ret >= 2) { + pr_err("%s is still in use, cannot remove.\n", + dv->devname); + close(lfd); + return -1; + } } } /* FIXME check that it is a current member */ -- 2.16.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor