aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-09-09 00:00:15 -0400
committerNeilBrown <neilb@suse.de>2014-10-13 22:08:28 -0400
commit9ba3b7f5d025915be2b8709e5fd35c9c3e9f14c6 (patch)
tree074ea9213eca55d8a6b7c96b671a10414018f097
parentc95e6385e8098ef549008ab29d671bf528a50043 (diff)
md: be more relaxed about stopping an array which isn't started.
In general we don't allow an array to be stopped if it is in use. However if the array hasn't really been started yet, then any apparent use is an anomily, probably due to 'udev' or similar having a look to see what is there. This means that if something goes wrong while assembling an array it cannot reliably be un-assembled - STOP_ARRAY could fail. There is no value here, so change do_md_stop() to succeed despite concurrent opens if the array has not yet been activated. i.e. if ->pers is NULL. Reported-by: "Baldysiak, Pawel" <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/md.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1294238610df..4c72e9626eff 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5307,7 +5307,7 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
5307 mddev_lock_nointr(mddev); 5307 mddev_lock_nointr(mddev);
5308 5308
5309 mutex_lock(&mddev->open_mutex); 5309 mutex_lock(&mddev->open_mutex);
5310 if (atomic_read(&mddev->openers) > !!bdev || 5310 if ((mddev->pers && atomic_read(&mddev->openers) > !!bdev) ||
5311 mddev->sync_thread || 5311 mddev->sync_thread ||
5312 (bdev && !test_bit(MD_STILL_CLOSED, &mddev->flags))) { 5312 (bdev && !test_bit(MD_STILL_CLOSED, &mddev->flags))) {
5313 printk("md: %s still in use.\n",mdname(mddev)); 5313 printk("md: %s still in use.\n",mdname(mddev));
@@ -5362,7 +5362,7 @@ static int do_md_stop(struct mddev * mddev, int mode,
5362 mddev_lock_nointr(mddev); 5362 mddev_lock_nointr(mddev);
5363 5363
5364 mutex_lock(&mddev->open_mutex); 5364 mutex_lock(&mddev->open_mutex);
5365 if (atomic_read(&mddev->openers) > !!bdev || 5365 if ((mddev->pers && atomic_read(&mddev->openers) > !!bdev) ||
5366 mddev->sysfs_active || 5366 mddev->sysfs_active ||
5367 mddev->sync_thread || 5367 mddev->sync_thread ||
5368 (bdev && !test_bit(MD_STILL_CLOSED, &mddev->flags))) { 5368 (bdev && !test_bit(MD_STILL_CLOSED, &mddev->flags))) {
@@ -6454,7 +6454,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
6454 * and writes 6454 * and writes
6455 */ 6455 */
6456 mutex_lock(&mddev->open_mutex); 6456 mutex_lock(&mddev->open_mutex);
6457 if (atomic_read(&mddev->openers) > 1) { 6457 if (mddev->pers && atomic_read(&mddev->openers) > 1) {
6458 mutex_unlock(&mddev->open_mutex); 6458 mutex_unlock(&mddev->open_mutex);
6459 err = -EBUSY; 6459 err = -EBUSY;
6460 goto abort; 6460 goto abort;