Skip to contentSkip to conversation

md: remove legacy 1s delay in md_notify_reboot

RFC PATCH Applied Tarun Sahu 3 participants 4 messages Nov 21, 2025 – Dec 1, 2025

Subsystems (2)
lore
Share & tools
lore

Tarun Sahu

author
#0 lore raw

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

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.

---
v2:
Added linux-scsi mailing list

 drivers/md/md.c | 11 -----------
 1 file changed, 11 deletions(-)
drivers/md/md.c +0 -11
index b086cbf24086..66c4d66b4b86 100644
@@ -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;
 }
 
Signature · 1 line
2.52.0.rc2.455.g230fcf2819-goog
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · 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.

Quoted 7 lines

---
v2:
Added linux-scsi mailing list

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

LGTM

Signature · 2 lines
Thanks,
Kuai
Applied
#2 lore raw
In reply to Tarun Sahu
Quoted 39 lines · 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.

---
v2:
Added linux-scsi mailing list

  drivers/md/md.c | 11 -----------
  1 file changed, 11 deletions(-)
drivers/md/md.c +0 -4
index b086cbf24086..66c4d66b4b86 100644
@@ -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

drivers/md/md.c static int md_notify_reboot(struct notifier_block *this, · line 9727

Quoted 10 lines
drivers/md/md.c +0 -7
-	 * 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

Signature · 2 lines
Thanks,
Kuai
#3 lore raw
Quoted 40 lines · Yu Kuai
Quoted 37 lines · 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.

---
v2:
Added linux-scsi mailing list

  drivers/md/md.c | 11 -----------
  1 file changed, 11 deletions(-)
drivers/md/md.c +0 -2
index b086cbf24086..66c4d66b4b86 100644
@@ -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);
 
Quoted 14 lines

drivers/md/md.c static int md_notify_reboot(struct notifier_block *this, · line 9727

Quoted 12 lines
drivers/md/md.c +0 -9
-     /*
-      * 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