From 8f465351a2cdc4004d1142c003fa5a86334a9ff1 Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Tue, 19 May 2009 14:25:55 +0000 Subject: [PATCH] - Only check raid devices automatically, do not attempt to repair them during the weekly data scrubbing --- mdadm-3.0-mapfile.patch | 143 ++++++++++++++++++++-------------------- mdadm.spec | 6 +- raid-check | 2 +- 3 files changed, 79 insertions(+), 72 deletions(-) diff --git a/mdadm-3.0-mapfile.patch b/mdadm-3.0-mapfile.patch index 9e75e4d..ce41b00 100644 --- a/mdadm-3.0-mapfile.patch +++ b/mdadm-3.0-mapfile.patch @@ -1,38 +1,9 @@ ---- mdadm-3.0-devel3/Incremental.c.dev 2009-03-20 13:19:35.000000000 -0400 -+++ mdadm-3.0-devel3/Incremental.c 2009-03-20 13:20:01.000000000 -0400 -@@ -52,7 +52,7 @@ int Incremental(char *devname, int verbo - * a 'foreign' array. - * 4/ Determine device number. - * - If in mdadm.conf with std name, use that -- * - UUID in /var/run/mdadm.map use that -+ * - UUID in /dev/md/mdadm.map use that - * - If name is suggestive, use that. unless in use with different uuid. - * - Choose a free, high number. - * - Use a partitioned device unless strong suggestion not to. -@@ -67,7 +67,7 @@ int Incremental(char *devname, int verbo - * - check one drive in array to make sure metadata is a reasonably - * close match. Reject if not (e.g. different type) - * - add the device -- * 6/ Make sure /var/run/mdadm.map contains this array. -+ * 6/ Make sure /dev/md/mdadm.map contains this array. - * 7/ Is there enough devices to possibly start the array? - * For a container, this means running Incremental_container. - * 7a/ if not, finish with success. -@@ -315,7 +315,7 @@ int Incremental(char *devname, int verbo - } - info.array.working_disks = 1; - sysfs_free(sra); -- /* 6/ Make sure /var/run/mdadm.map contains this array. */ -+ /* 6/ Make sure /dev/md/mdadm.map contains this array. */ - map_update(&map, fd2devnum(mdfd), - info.text_version, - info.uuid, chosen_name); ---- mdadm-3.0-devel3/mapfile.c.dev 2009-03-20 13:16:27.000000000 -0400 -+++ mdadm-3.0-devel3/mapfile.c 2009-03-20 13:18:37.000000000 -0400 +--- mdadm-3.0-devel3/mapfile.c.mapfile 2009-03-10 01:39:41.000000000 -0400 ++++ mdadm-3.0-devel3/mapfile.c 2009-04-17 13:22:45.000000000 -0400 @@ -1,5 +1,5 @@ /* - * mapfile - manage /var/run/mdadm.map. Part of: -+ * mapfile - manage /dev/md/mdadm.map. Part of: ++ * mapfile - manage /dev/.mdadm.map. Part of: * mdadm - manage Linux "md" devices aka RAID arrays. * * Copyright (C) 2006 Neil Brown @@ -41,87 +12,119 @@ */ -/* /var/run/mdadm.map is used to track arrays being created in --incremental -+/* /dev/md/mdadm.map is used to track arrays being created in --incremental ++/* /dev/.mdadm.map is used to track arrays being created in --incremental * more. It particularly allows lookup from UUID to array device, but * also allows the array device name to be easily found. * -@@ -50,9 +50,9 @@ int map_write(struct map_ent *mel) +@@ -48,13 +48,8 @@ + { + FILE *f; int err; - int subdir = 1; +- int subdir = 1; - f = fopen("/var/run/mdadm/map.new", "w"); -+ f = fopen("/dev/md/mdadm/map.new", "w"); - if (!f) { +- if (!f) { - f = fopen("/var/run/mdadm.map.new", "w"); -+ f = fopen("/dev/md/mdadm.map.new", "w"); - subdir = 0; - } +- subdir = 0; +- } ++ f = fopen("/dev/.mdadm.map.new", "w"); if (!f) -@@ -74,17 +74,17 @@ int map_write(struct map_ent *mel) + return 0; + for (; mel; mel = mel->next) { +@@ -73,32 +68,19 @@ + err = ferror(f); fclose(f); if (err) { - if (subdir) +- if (subdir) - unlink("/var/run/mdadm/map.new"); -+ unlink("/dev/md/mdadm/map.new"); - else +- else - unlink("/var/run/mdadm.map.new"); -+ unlink("/dev/md/mdadm.map.new"); ++ unlink("/dev/.mdadm.map.new"); return 0; } - if (subdir) +- if (subdir) - return rename("/var/run/mdadm/map.new", - "/var/run/mdadm/map") == 0; -+ return rename("/dev/md/mdadm/map.new", -+ "/dev/md/mdadm/map") == 0; - else +- else - return rename("/var/run/mdadm.map.new", - "/var/run/mdadm.map") == 0; -+ return rename("/dev/md/mdadm.map.new", -+ "/dev/md/mdadm.map") == 0; ++ return rename("/dev/.mdadm.map.new", ++ "/dev/.mdadm.map") == 0; } -@@ -93,9 +93,9 @@ static int lsubdir = 0; + static int lfd = -1; +-static int lsubdir = 0; int map_lock(struct map_ent **melp) { if (lfd < 0) { - lfd = open("/var/run/mdadm/map.lock", O_CREAT|O_RDWR, 0600); -+ lfd = open("/dev/md/mdadm/map.lock", O_CREAT|O_RDWR, 0600); - if (lfd < 0) { +- if (lfd < 0) { - lfd = open("/var/run/mdadm.map.lock", O_CREAT|O_RDWR, 0600); -+ lfd = open("/dev/md/mdadm.map.lock", O_CREAT|O_RDWR, 0600); - lsubdir = 0; - } else - lsubdir = 1; -@@ -118,9 +118,9 @@ void map_unlock(struct map_ent **melp) +- lsubdir = 0; +- } else +- lsubdir = 1; ++ lfd = open("/dev/.mdadm.map.lock", O_CREAT|O_RDWR, 0600); + if (lfd < 0) + return -1; + if (lockf(lfd, F_LOCK, 0) != 0) { +@@ -117,10 +99,7 @@ + { if (lfd >= 0) close(lfd); - if (lsubdir) +- if (lsubdir) - unlink("/var/run/mdadm/map.lock"); -+ unlink("/dev/md/mdadm/map.lock"); - else +- else - unlink("/var/run/mdadm.map.lock"); -+ unlink("/dev/md/mdadm.map.lock"); ++ unlink("/dev/.mdadm.map.lock"); lfd = -1; } -@@ -149,15 +149,15 @@ void map_read(struct map_ent **melp) +@@ -149,16 +128,12 @@ *melp = NULL; - f = fopen("/var/run/mdadm/map", "r"); -+ f = fopen("/dev/md/mdadm/map", "r"); - if (!f) +- if (!f) - f = fopen("/var/run/mdadm.map", "r"); -+ f = fopen("/dev/md/mdadm.map", "r"); ++ f = fopen("/dev/.mdadm.map", "r"); if (!f) { RebuildMap(); - f = fopen("/var/run/mdadm/map", "r"); -+ f = fopen("/dev/md/mdadm/map", "r"); ++ f = fopen("/dev/.mdadm.map", "r"); } if (!f) - f = fopen("/var/run/mdadm.map", "r"); -+ f = fopen("/dev/md/mdadm.map", "r"); - if (!f) +- if (!f) return; + while (fgets(buf, sizeof(buf), f)) { +--- mdadm-3.0-devel3/Incremental.c.mapfile 2009-03-10 01:39:41.000000000 -0400 ++++ mdadm-3.0-devel3/Incremental.c 2009-03-20 21:21:51.000000000 -0400 +@@ -52,7 +52,7 @@ + * a 'foreign' array. + * 4/ Determine device number. + * - If in mdadm.conf with std name, use that +- * - UUID in /var/run/mdadm.map use that ++ * - UUID in /dev/md/mdadm.map use that + * - If name is suggestive, use that. unless in use with different uuid. + * - Choose a free, high number. + * - Use a partitioned device unless strong suggestion not to. +@@ -67,7 +67,7 @@ + * - check one drive in array to make sure metadata is a reasonably + * close match. Reject if not (e.g. different type) + * - add the device +- * 6/ Make sure /var/run/mdadm.map contains this array. ++ * 6/ Make sure /dev/md/mdadm.map contains this array. + * 7/ Is there enough devices to possibly start the array? + * For a container, this means running Incremental_container. + * 7a/ if not, finish with success. +@@ -315,7 +315,7 @@ + } + info.array.working_disks = 1; + sysfs_free(sra); +- /* 6/ Make sure /var/run/mdadm.map contains this array. */ ++ /* 6/ Make sure /dev/md/mdadm.map contains this array. */ + map_update(&map, fd2devnum(mdfd), + info.text_version, + info.uuid, chosen_name); diff --git a/mdadm.spec b/mdadm.spec index 21679ef..86478e3 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,7 +1,7 @@ Summary: The mdadm program controls Linux md devices (software RAID arrays) Name: mdadm Version: 3.0 -Release: 0.devel3.5%{?dist} +Release: 0.devel3.6%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}-devel3.tar.bz2 Source1: mdmonitor.init Source2: raid-check @@ -87,6 +87,10 @@ fi %attr(0700,root,root) %dir /var/run/mdadm %changelog +* Tue May 19 2009 Doug Ledford - 3.0-0.devel3.6 +- Only check raid devices automatically, do not attempt to repair them + during the weekly data scrubbing + * Fri Mar 20 2009 Doug Ledford - 3.0-0.devel3.5 - Fix a few issues with the new code to determine when a device gets to keep its name and when it doesn't diff --git a/raid-check b/raid-check index 31091bf..56eaf75 100644 --- a/raid-check +++ b/raid-check @@ -1,6 +1,6 @@ #!/bin/bash for dev in `grep "^md.*: active" /proc/mdstat | cut -f 1 -d ' '`; do - echo "repair" > /sys/block/$dev/md/sync_action + echo "check" > /sys/block/$dev/md/sync_action done