@@ -4482,8 +4482,8 @@ array_state_show(struct mddev *mddev, char *page)
4482
4482
return sprintf (page , "%s\n" , array_states [st ]);
4483
4483
}
4484
4484
4485
- static int do_md_stop (struct mddev * mddev , int ro , struct block_device * bdev );
4486
- static int md_set_readonly (struct mddev * mddev , struct block_device * bdev );
4485
+ static int do_md_stop (struct mddev * mddev , int ro );
4486
+ static int md_set_readonly (struct mddev * mddev );
4487
4487
static int restart_array (struct mddev * mddev );
4488
4488
4489
4489
static ssize_t
@@ -4544,14 +4544,14 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len)
4544
4544
case inactive :
4545
4545
/* stop an active array, return 0 otherwise */
4546
4546
if (mddev -> pers )
4547
- err = do_md_stop (mddev , 2 , NULL );
4547
+ err = do_md_stop (mddev , 2 );
4548
4548
break ;
4549
4549
case clear :
4550
- err = do_md_stop (mddev , 0 , NULL );
4550
+ err = do_md_stop (mddev , 0 );
4551
4551
break ;
4552
4552
case readonly :
4553
4553
if (mddev -> pers )
4554
- err = md_set_readonly (mddev , NULL );
4554
+ err = md_set_readonly (mddev );
4555
4555
else {
4556
4556
mddev -> ro = MD_RDONLY ;
4557
4557
set_disk_ro (mddev -> gendisk , 1 );
@@ -4561,7 +4561,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len)
4561
4561
case read_auto :
4562
4562
if (mddev -> pers ) {
4563
4563
if (md_is_rdwr (mddev ))
4564
- err = md_set_readonly (mddev , NULL );
4564
+ err = md_set_readonly (mddev );
4565
4565
else if (mddev -> ro == MD_RDONLY )
4566
4566
err = restart_array (mddev );
4567
4567
if (err == 0 ) {
@@ -6420,7 +6420,7 @@ void md_stop(struct mddev *mddev)
6420
6420
6421
6421
EXPORT_SYMBOL_GPL (md_stop );
6422
6422
6423
- static int md_set_readonly (struct mddev * mddev , struct block_device * bdev )
6423
+ static int md_set_readonly (struct mddev * mddev )
6424
6424
{
6425
6425
int err = 0 ;
6426
6426
int did_freeze = 0 ;
@@ -6438,9 +6438,7 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
6438
6438
!test_bit (MD_SB_CHANGE_PENDING , & mddev -> sb_flags ));
6439
6439
mddev_lock_nointr (mddev );
6440
6440
6441
- mutex_lock (& mddev -> open_mutex );
6442
- if ((mddev -> pers && atomic_read (& mddev -> openers ) > !!bdev ) ||
6443
- test_bit (MD_RECOVERY_RUNNING , & mddev -> recovery )) {
6441
+ if (test_bit (MD_RECOVERY_RUNNING , & mddev -> recovery )) {
6444
6442
pr_warn ("md: %s still in use.\n" ,mdname (mddev ));
6445
6443
err = - EBUSY ;
6446
6444
goto out ;
@@ -6465,16 +6463,14 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
6465
6463
sysfs_notify_dirent_safe (mddev -> sysfs_state );
6466
6464
}
6467
6465
6468
- mutex_unlock (& mddev -> open_mutex );
6469
6466
return err ;
6470
6467
}
6471
6468
6472
6469
/* mode:
6473
6470
* 0 - completely stop and dis-assemble array
6474
6471
* 2 - stop but do not disassemble array
6475
6472
*/
6476
- static int do_md_stop (struct mddev * mddev , int mode ,
6477
- struct block_device * bdev )
6473
+ static int do_md_stop (struct mddev * mddev , int mode )
6478
6474
{
6479
6475
struct gendisk * disk = mddev -> gendisk ;
6480
6476
struct md_rdev * rdev ;
@@ -6487,12 +6483,9 @@ static int do_md_stop(struct mddev *mddev, int mode,
6487
6483
6488
6484
stop_sync_thread (mddev , true, false);
6489
6485
6490
- mutex_lock (& mddev -> open_mutex );
6491
- if ((mddev -> pers && atomic_read (& mddev -> openers ) > !!bdev ) ||
6492
- mddev -> sysfs_active ||
6486
+ if (mddev -> sysfs_active ||
6493
6487
test_bit (MD_RECOVERY_RUNNING , & mddev -> recovery )) {
6494
6488
pr_warn ("md: %s still in use.\n" ,mdname (mddev ));
6495
- mutex_unlock (& mddev -> open_mutex );
6496
6489
if (did_freeze ) {
6497
6490
clear_bit (MD_RECOVERY_FROZEN , & mddev -> recovery );
6498
6491
set_bit (MD_RECOVERY_NEEDED , & mddev -> recovery );
@@ -6514,13 +6507,11 @@ static int do_md_stop(struct mddev *mddev, int mode,
6514
6507
sysfs_unlink_rdev (mddev , rdev );
6515
6508
6516
6509
set_capacity_and_notify (disk , 0 );
6517
- mutex_unlock (& mddev -> open_mutex );
6518
6510
mddev -> changed = 1 ;
6519
6511
6520
6512
if (!md_is_rdwr (mddev ))
6521
6513
mddev -> ro = MD_RDWR ;
6522
- } else
6523
- mutex_unlock (& mddev -> open_mutex );
6514
+ }
6524
6515
/*
6525
6516
* Free resources if final stop
6526
6517
*/
@@ -6566,7 +6557,7 @@ static void autorun_array(struct mddev *mddev)
6566
6557
err = do_md_run (mddev );
6567
6558
if (err ) {
6568
6559
pr_warn ("md: do_md_run() returned %d\n" , err );
6569
- do_md_stop (mddev , 0 , NULL );
6560
+ do_md_stop (mddev , 0 );
6570
6561
}
6571
6562
}
6572
6563
@@ -7735,11 +7726,11 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
7735
7726
goto unlock ;
7736
7727
7737
7728
case STOP_ARRAY :
7738
- err = do_md_stop (mddev , 0 , bdev );
7729
+ err = do_md_stop (mddev , 0 );
7739
7730
goto unlock ;
7740
7731
7741
7732
case STOP_ARRAY_RO :
7742
- err = md_set_readonly (mddev , bdev );
7733
+ err = md_set_readonly (mddev );
7743
7734
goto unlock ;
7744
7735
7745
7736
case HOT_REMOVE_DISK :
0 commit comments