]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Don't fail md_open if array already active.
authorLuca Berra <bluca@comedia.it>
Mon, 16 Oct 2006 05:27:16 +0000 (15:27 +1000)
committerNeil Brown <neilb@suse.de>
Mon, 16 Oct 2006 05:27:16 +0000 (15:27 +1000)
From: Luca Berra <bluca@comedia.it>

There is no need and it causes occasional problems.

ChangeLog
mdopen.c

index 0f087a71379f7642ed9952cd7305c131f491efe7..9bd989120c9ca7db2aa5b510dce3e92bdeefbc82 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@ Changes Prior to this release
        devices
     -   If mdassemble finds an array already assembled, it marks it
         read-write.
+    -   Remove error in md_open if array is already active.  This isn't
+       needed and gets in the ways if an array was created e.g. in
+       initramfs, but device doesn't yet exist in /dev.
 
 Changes Prior to 2.5.4 release
     -   When creating devices in /dev/md/ create matching symlinks
index 0c049a03e01568b4427102c12b0e32e1b8c4047b..53b84e4c27cea941ac4581976fb7aa40fc325f95 100644 (file)
--- a/mdopen.c
+++ b/mdopen.c
@@ -171,7 +171,6 @@ int open_mddev(char *dev, int autof)
                if (stb.st_mode && major(stb.st_rdev) != major)
                        must_remove = 1;
                if (stb.st_mode && !must_remove) {
-                       mdu_array_info_t array;
                        /* looks ok, see if it is available */
                        mdfd = open(dev, O_RDWR, 0);
                        if (mdfd < 0) {
@@ -184,17 +183,9 @@ int open_mddev(char *dev, int autof)
                                close(mdfd);
                                return -1;
                        }
-                       if (ioctl(mdfd, GET_ARRAY_INFO, &array)==0) {
-                               /* already active */
-                               close(mdfd);
-                               fprintf(stderr, Name ": %s is already active.\n",
-                                       dev);
-                               return -1;
-                       } else {
-                               if (major != MD_MAJOR && parts > 0)
-                                       make_parts(dev, parts, ci->symlinks);
-                               return mdfd;
-                       }
+                       if (major != MD_MAJOR && parts > 0)
+                               make_parts(dev, parts, ci->symlinks);
+                       return mdfd;
                }
                /* Ok, need to find a minor that is not in use.
                 * If the device name is in a 'standard' format,