Bug 85313 - mkraid fails to create /dev/md1 if /dev/md10 exists
mkraid fails to create /dev/md1 if /dev/md10 exists
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: raidtools (Show other bugs)
7.3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Doug Ledford
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-02-27 16:53 EST by Paul Clements
Modified: 2007-04-18 12:51 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-11-27 18:24:45 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Paul Clements 2003-02-27 16:53:12 EST
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:

Note You need to log in before you can comment on or make changes to this bug.