ACK: [SRU][Zesty][PATCH 1/1] md: MD_CLOSING needs to be cleared after called md_set_readonly or do_md_stop

Stefan Bader stefan.bader at canonical.com
Wed Sep 27 18:46:54 UTC 2017


On 26.09.2017 11:19, Joseph Salisbury wrote:
> From: NeilBrown <neilb at suse.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1706243
> 
> if called md_set_readonly and set MD_CLOSING bit, the mddev cannot
> be opened any more due to the MD_CLOING bit wasn't cleared. Thus it
> needs to be cleared in md_ioctl after any call to md_set_readonly()
> or do_md_stop().
> 
> Signed-off-by: NeilBrown <neilb at suse.com>
> Fixes: af8d8e6f0315 ("md: changes for MD_STILL_CLOSED flag")
> Cc: stable at vger.kernel.org (v4.9+)
> Signed-off-by: Zhilong Liu <zlliu at suse.com>
> Signed-off-by: Shaohua Li <shli at fb.com>
> (cherry picked from commit 065e519e71b2c1f41936cce75b46b5ab34adb588)
> Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>

> ---
>  drivers/md/md.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 01175da..643920c 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -6787,6 +6787,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
>  	void __user *argp = (void __user *)arg;
>  	struct mddev *mddev = NULL;
>  	int ro;
> +	bool did_set_md_closing = false;
>  
>  	if (!md_ioctl_valid(cmd))
>  		return -ENOTTY;
> @@ -6876,7 +6877,9 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
>  			err = -EBUSY;
>  			goto out;
>  		}
> +		WARN_ON_ONCE(test_bit(MD_CLOSING, &mddev->flags));
>  		set_bit(MD_CLOSING, &mddev->flags);
> +		did_set_md_closing = true;
>  		mutex_unlock(&mddev->open_mutex);
>  		sync_blockdev(bdev);
>  	}
> @@ -7069,6 +7072,8 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
>  		mddev->hold_active = 0;
>  	mddev_unlock(mddev);
>  out:
> +	if(did_set_md_closing)
> +		clear_bit(MD_CLOSING, &mddev->flags);
>  	return err;
>  }
>  #ifdef CONFIG_COMPAT
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20170927/040b639f/attachment.sig>


More information about the kernel-team mailing list