[patch] 2.4 raid shutdown issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kernel 2.4.19
I've found a minor problem with software RAID during linux shutdown.
If the raid device contains a filesystem, and the filesystem wasn't dismounted 
at shutdown time, the RAID device will not shutdown properly, and at next 
reboot it'll need a resync.
This happens when:
- I have the root filesystem on a RAID1 device
- The RAID isn't compiled as module
- The RAID partition id is 0xfd (linux raid autodetect)
So I wrote this kernel patch forcing read-only mode for every RAID device, 
before shutdown.
This is my first kernel patch, so, maybe, there could be a cleaner way to 
resolve this issue; please, let me know your opinion on it.

*****************

--- linux/drivers/md/md.c.orig	2002-10-13 21:37:34.000000000 +0200
+++ linux/drivers/md/md.c	2002-10-13 23:55:15.000000000 +0200
@@ -1794,9 +1794,15 @@
 	int err = 0, resync_interrupted = 0;
 	kdev_t dev = mddev_to_kdev(mddev);
 
-	if (atomic_read(&mddev->active)>1) {
-		printk(STILL_IN_USE, mdidx(mddev));
-		OUT(-EBUSY);
+	if (ro < 3 ) {
+		if (atomic_read(&mddev->active)>1) {
+			printk(STILL_IN_USE, mdidx(mddev));
+			OUT(-EBUSY);
+		}
+	} else {
+		if (atomic_read(&mddev->active)>1) {
+			printk("md: md%d forcing to read-only mode\n", mdidx(mddev));
+		}
 	}
 
 	if (mddev->pers) {
@@ -3608,7 +3614,7 @@
 		printk(KERN_INFO "md: stopping all md devices.\n");
 
 		ITERATE_MDDEV(mddev,tmp)
-			do_md_stop (mddev, 1);
+			do_md_stop (mddev, 3);
 		/*
 		 * certain more exotic SCSI devices are known to be
 		 * volatile wrt too early system reboots. While the




*****************

Thanks
Emilio Gargiulo 
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux