]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Manage.c
imsm: pass subarray id to kill_subarray function
[thirdparty/mdadm.git] / Manage.c
index b82a7293f0f14da0398236690e07442a4c46ef0a..b22c3969f05c7a3c7dc29f6bd32501cb22bdbd1c 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -741,18 +741,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
                       "       Adding anyway as --force was given.\n",
                       dv->devname, devname);
        }
-       if (!tst->ss->external && array->major_version == 0) {
-               if (ioctl(fd, HOT_ADD_DISK, rdev)==0) {
-                       if (verbose >= 0)
-                               pr_err("hot added %s\n",
-                                      dv->devname);
-                       return 1;
-               }
-
-               pr_err("hot add failed for %s: %s\n",
-                      dv->devname, strerror(errno));
-               return -1;
-       }
 
        if (array->not_persistent == 0 || tst->ss->external) {
 
@@ -1301,8 +1289,6 @@ int Manage_subdevs(char *devname, int fd,
        /* Do something to each dev.
         * devmode can be
         *  'a' - add the device
-        *         try HOT_ADD_DISK
-        *         If that fails EINVAL, try ADD_NEW_DISK
         *  'S' - add the device as a spare - don't try re-add
         *  'j' - add the device as a journal device
         *  'A' - re-add the device
@@ -1367,7 +1353,7 @@ int Manage_subdevs(char *devname, int fd,
        }
 
        for (dv = devlist; dv; dv = dv->next) {
-               unsigned long rdev = 0; /* device to add/remove etc */
+               dev_t rdev = 0; /* device to add/remove etc */
                int rv;
                int mj,mn;
 
@@ -1417,7 +1403,7 @@ int Manage_subdevs(char *devname, int fd,
                        }
                        add_devlist = conf_get_devs();
                        if (add_devlist == NULL) {
-                               pr_err("no devices to scan for missing members.");
+                               pr_err("no devices to scan for missing members.\n");
                                continue;
                        }
                        for (dp = &add_devlist; *dp; dp = & (*dp)->next)
@@ -1742,8 +1728,10 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid)
        int fd2 = open(from_devname, O_RDONLY);
 
        if (fd1 < 0 || fd2 < 0) {
-               if (fd1>=0) close(fd1);
-               if (fd2>=0) close(fd2);
+               if (fd1 >= 0)
+                       close(fd1);
+               if (fd2 >= 0)
+                       close(fd2);
                return 0;
        }
 
@@ -1757,7 +1745,8 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid)
        devlist.disposition = 'r';
        if (Manage_subdevs(from_devname, fd2, &devlist, -1, 0, NULL, 0) == 0) {
                devlist.disposition = 'a';
-               if (Manage_subdevs(to_devname, fd1, &devlist, -1, 0, NULL, 0) == 0) {
+               if (Manage_subdevs(to_devname, fd1, &devlist, -1, 0,
+                                  NULL, 0) == 0) {
                        /* make sure manager is aware of changes */
                        ping_manager(to_devname);
                        ping_manager(from_devname);
@@ -1765,7 +1754,9 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid)
                        close(fd2);
                        return 1;
                }
-               else Manage_subdevs(from_devname, fd2, &devlist, -1, 0, NULL, 0);
+               else
+                       Manage_subdevs(from_devname, fd2, &devlist,
+                                      -1, 0, NULL, 0);
        }
        close(fd1);
        close(fd2);