[RFC PATCH v2] md: remove legacy 1s delay in md_notify_reboot

Tarun Sahu posted 1 patch 1 week, 3 days ago
drivers/md/md.c | 11 -----------
1 file changed, 11 deletions(-)
[RFC PATCH v2] md: remove legacy 1s delay in md_notify_reboot
Posted by Tarun Sahu 1 week, 3 days ago
During system shutdown, the md driver registered notifier function
(md_notify_reboot) currently imposes a hardcoded one-second delay.

This delay was introduced approximately 23 years ago and was likely
necessary for the hardware generation of that time. Proposing this
patch to make sure there are no known devices that need this delay.

Signed-off-by: Tarun Sahu <tarunsahu@google.com>
---
v2:
	Added linux-scsi mailing list

 drivers/md/md.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index b086cbf24086..66c4d66b4b86 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9704,7 +9704,6 @@ static int md_notify_reboot(struct notifier_block *this,
 			    unsigned long code, void *x)
 {
 	struct mddev *mddev;
-	int need_delay = 0;
 
 	spin_lock(&all_mddevs_lock);
 	list_for_each_entry(mddev, &all_mddevs, all_mddevs) {
@@ -9718,21 +9717,11 @@ static int md_notify_reboot(struct notifier_block *this,
 				mddev->safemode = 2;
 			mddev_unlock(mddev);
 		}
-		need_delay = 1;
 		spin_lock(&all_mddevs_lock);
 		mddev_put_locked(mddev);
 	}
 	spin_unlock(&all_mddevs_lock);
 
-	/*
-	 * certain more exotic SCSI devices are known to be
-	 * volatile wrt too early system reboots. While the
-	 * right place to handle this issue is the given
-	 * driver, we do want to have a safe RAID driver ...
-	 */
-	if (need_delay)
-		msleep(1000);
-
 	return NOTIFY_DONE;
 }
 
-- 
2.52.0.rc2.455.g230fcf2819-goog
Re: [RFC PATCH v2] md: remove legacy 1s delay in md_notify_reboot
Posted by Yu Kuai 1 day, 22 hours ago
在 2025/11/22 3:14, Tarun Sahu 写道:

> During system shutdown, the md driver registered notifier function
> (md_notify_reboot) currently imposes a hardcoded one-second delay.
>
> This delay was introduced approximately 23 years ago and was likely
> necessary for the hardware generation of that time. Proposing this
> patch to make sure there are no known devices that need this delay.
>
> Signed-off-by: Tarun Sahu <tarunsahu@google.com>
> ---
> v2:
> 	Added linux-scsi mailing list
>
>   drivers/md/md.c | 11 -----------
>   1 file changed, 11 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index b086cbf24086..66c4d66b4b86 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -9704,7 +9704,6 @@ static int md_notify_reboot(struct notifier_block *this,
>   			    unsigned long code, void *x)
>   {
>   	struct mddev *mddev;
> -	int need_delay = 0;
>   
>   	spin_lock(&all_mddevs_lock);
>   	list_for_each_entry(mddev, &all_mddevs, all_mddevs) {
> @@ -9718,21 +9717,11 @@ static int md_notify_reboot(struct notifier_block *this,
>   				mddev->safemode = 2;
>   			mddev_unlock(mddev);
>   		}
> -		need_delay = 1;
>   		spin_lock(&all_mddevs_lock);
>   		mddev_put_locked(mddev);
>   	}
>   	spin_unlock(&all_mddevs_lock);
>   
> -	/*
> -	 * certain more exotic SCSI devices are known to be
> -	 * volatile wrt too early system reboots. While the
> -	 * right place to handle this issue is the given
> -	 * driver, we do want to have a safe RAID driver ...
> -	 */
> -	if (need_delay)
> -		msleep(1000);
> -
>   	return NOTIFY_DONE;
>   }
>   

Applied to md-6.19
-- 
Thanks,
Kuai
Re: [RFC PATCH v2] md: remove legacy 1s delay in md_notify_reboot
Posted by Pasha Tatashin 7 hours ago
On Sat, Nov 29, 2025 at 8:58 PM Yu Kuai <yukuai@fnnas.com> wrote:
>
> 在 2025/11/22 3:14, Tarun Sahu 写道:
>
> > During system shutdown, the md driver registered notifier function
> > (md_notify_reboot) currently imposes a hardcoded one-second delay.
> >
> > This delay was introduced approximately 23 years ago and was likely
> > necessary for the hardware generation of that time. Proposing this
> > patch to make sure there are no known devices that need this delay.
> >
> > Signed-off-by: Tarun Sahu <tarunsahu@google.com>
> > ---
> > v2:
> >       Added linux-scsi mailing list
> >
> >   drivers/md/md.c | 11 -----------
> >   1 file changed, 11 deletions(-)
> >
> > diff --git a/drivers/md/md.c b/drivers/md/md.c
> > index b086cbf24086..66c4d66b4b86 100644
> > --- a/drivers/md/md.c
> > +++ b/drivers/md/md.c
> > @@ -9704,7 +9704,6 @@ static int md_notify_reboot(struct notifier_block *this,
> >                           unsigned long code, void *x)
> >   {
> >       struct mddev *mddev;
> > -     int need_delay = 0;
> >
> >       spin_lock(&all_mddevs_lock);
> >       list_for_each_entry(mddev, &all_mddevs, all_mddevs) {
> > @@ -9718,21 +9717,11 @@ static int md_notify_reboot(struct notifier_block *this,
> >                               mddev->safemode = 2;
> >                       mddev_unlock(mddev);
> >               }
> > -             need_delay = 1;
> >               spin_lock(&all_mddevs_lock);
> >               mddev_put_locked(mddev);
> >       }
> >       spin_unlock(&all_mddevs_lock);
> >
> > -     /*
> > -      * certain more exotic SCSI devices are known to be
> > -      * volatile wrt too early system reboots. While the
> > -      * right place to handle this issue is the given
> > -      * driver, we do want to have a safe RAID driver ...
> > -      */
> > -     if (need_delay)
> > -             msleep(1000);
> > -
> >       return NOTIFY_DONE;
> >   }
> >
>
> Applied to md-6.19

Awesome, thanks.

Pasha
Re: [RFC PATCH v2] md: remove legacy 1s delay in md_notify_reboot
Posted by Yu Kuai 1 week, 1 day ago
在 2025/11/22 3:14, Tarun Sahu 写道:
> During system shutdown, the md driver registered notifier function
> (md_notify_reboot) currently imposes a hardcoded one-second delay.
>
> This delay was introduced approximately 23 years ago and was likely
> necessary for the hardware generation of that time. Proposing this
> patch to make sure there are no known devices that need this delay.
>
> Signed-off-by: Tarun Sahu<tarunsahu@google.com>
> ---
> v2:
> 	Added linux-scsi mailing list
>
>   drivers/md/md.c | 11 -----------
>   1 file changed, 11 deletions(-)

LGTM
Reviewed-by: Yu Kuai<yukuai@fnnas.com>

-- 
Thanks,
Kuai