linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Suggested patch against raidtools
@ 2003-03-09 23:46 Simon Edwards
  2003-03-10  5:54 ` Paul Clements
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Edwards @ 2003-03-09 23:46 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

Hello,
	I know that mdadm appears to be in vogue at present, but for any
of you using the "raidtools" suite of programs, please find a patch
against raidtools-1.00.3. The patch addresses a couple of problems I
found in raidtools - mainly due to the coding assumption that only raid
devices "md0 - md9" would be used - if you try and use "md1" and "md10"
you'll get an error saying the device is already running.

	The patch also includes the --no-delay flag for mkraid which is
used to avoid the 5 second warning included when using the
--dangerous-no-resync option. I've found this useful for avoiding the
delay when using mkraid in scripts.

Regards,

Simon.


[-- Attachment #2: raidtools-1.00.3.patch.gz --]
[-- Type: application/x-gzip, Size: 771 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Suggested patch against raidtools
  2003-03-09 23:46 Suggested patch against raidtools Simon Edwards
@ 2003-03-10  5:54 ` Paul Clements
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Clements @ 2003-03-10  5:54 UTC (permalink / raw)
  To: Simon Edwards; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

Simon Edwards wrote:

> if you try and use "md1" and "md10"
> you'll get an error saying the device is already running.

Hmm...coincidentally, I just reported this same bug to Red Hat a couple
of days ago. The patch that I came up with is attached...although, yours
seems to be a little simpler.

--
Paul

[-- Attachment #2: raidtools.diff --]
[-- Type: text/plain, Size: 966 bytes --]

diff -urN raidtools-1.00.2/raid_io.c raidtools-1.00.2steeleye/raid_io.c
--- raidtools-1.00.2/raid_io.c	Mon Apr 15 04:09:11 2002
+++ raidtools-1.00.2steeleye/raid_io.c	Thu Feb 27 15:22:07 2003
@@ -515,8 +515,10 @@
 }
 
 
+
 int check_active (md_cfg_entry_t *p)
 {
+	char md_dev_chars[] = "0123456789md";
 	char buffer[MAX_LINE_LENGTH], line[MAX_LINE_LENGTH], *ch;
 	FILE *fp;
 
@@ -528,11 +530,15 @@
 	while (1) {
 		if ((fgets(line, MAX_LINE_LENGTH, fp)) == NULL)
 			break;
-		if (strstr(line, buffer) && !strstr(line, "inactive")) {
-			fprintf(stderr, "%s: array is active -- run raidstop first.\n", p->md_name);
-			fclose(fp);
-			return 1;
-		}
+		if (!(ch = strstr(line, buffer)))
+			continue;
+		if (strspn(ch, md_dev_chars) != strspn(buffer, md_dev_chars))
+			continue;
+		if (strstr(line, "inactive"))
+			continue;
+		fprintf(stderr, "%s: array is active -- run raidstop first.\n", p->md_name);
+		fclose(fp);
+		return 1;
 	}
 	fclose(fp);
 	return 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-10  5:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-09 23:46 Suggested patch against raidtools Simon Edwards
2003-03-10  5:54 ` Paul Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).