Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 85313

Summary: mkraid fails to create /dev/md1 if /dev/md10 exists
Product: [Retired] Red Hat Linux Reporter: Paul Clements <paul.clements>
Component: raidtoolsAssignee: Doug Ledford <dledford>
Status: CLOSED WONTFIX QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-11-27 23:24:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paul Clements 2003-02-27 21:53:12 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.7 [en] (X11; I; Linux 2.2.13 i686)

Description of problem:
I've verified that this problem affects at least raidtools 0.90 through 1.00
(Red Hat 7.2, 7.3, 8.0, and Advanced Server 2.1, at least).

In the code that checks to see if the array is already active (check_active(),
raid_io.c), the device matching is not done properly, and substring matches are
mistakenly considered matches. 

The patch (against raidtools-1.00.2-1.3, from Red Hat 7.3) for the fix is:

--- 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 fir
st.\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;





Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. mkraid -c <conf_file> /dev/md10

2. mkraid -c <conf_file> /dev/md1     **ALWAYS FAILS**
    

Additional info: