lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <75dd6e7d-383e-44c0-978a-42c286a3d9c3@fnnas.com>
Date: Thu, 25 Dec 2025 16:19:46 +0800
From: "Yu Kuai" <yukuai@...as.com>
To: "dannyshih" <dannyshih@...ology.com>, <song@...nel.org>
Cc: <linux-raid@...r.kernel.org>, <linux-kernel@...r.kernel.org>, 
	<yukuai@...as.com>
Subject: Re: [PATCH] md: suspend array while updating raid1 raid_disks via sysfs

Hi,

在 2025/12/18 17:06, dannyshih 写道:
> From: FengWei Shih <dannyshih@...ology.com>
>
> When an I/O error occurs, the corresponding r1bio might be queued during
> raid1_reshape() and not released. Leads to r1bio release with wrong
> raid_disks.

Please be more specific about the problem, mempool_destroy() will warn about
object still in use, and free r1bio with updated conf->raid_disks will cause
problem like memory oob.

>
> * raid1_reshape() calls freeze_array(), which only waits for r1bios be
>    queued or released.
>
> Since only normal I/O might be queued while an I/O error occurs, suspending
> the array avoids this issue.
>
> Signed-off-by: FengWei Shih <dannyshih@...ology.com>
> ---
>   drivers/md/md.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index e5922a682953..6424652bce6e 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -4402,12 +4402,13 @@ raid_disks_store(struct mddev *mddev, const char *buf, size_t len)
>   {
>   	unsigned int n;
>   	int err;
> +	bool need_suspend = (mddev->pers && mddev->level == 1);

Perhaps just suspend the array unconditionally, this will make sense.

>   
>   	err = kstrtouint(buf, 10, &n);
>   	if (err < 0)
>   		return err;
>   
> -	err = mddev_lock(mddev);
> +	err = need_suspend ? mddev_suspend_and_lock(mddev) : mddev_lock(mddev);
>   	if (err)
>   		return err;
>   	if (mddev->pers)
> @@ -4432,7 +4433,7 @@ raid_disks_store(struct mddev *mddev, const char *buf, size_t len)
>   	} else
>   		mddev->raid_disks = n;
>   out_unlock:
> -	mddev_unlock(mddev);
> +	need_suspend ? mddev_unlock_and_resume(mddev) : mddev_unlock(mddev);
>   	return err ? err : len;
>   }
>   static struct md_sysfs_entry md_raid_disks =

-- 
Thansk,
Kuai

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ