lkml.org 
[lkml]   [2002]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch] 2.4 raid shutdown issue
Date
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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:30    [W:0.028 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site