]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Manage.c
Document PPL in man md
[thirdparty/mdadm.git] / Manage.c
index cee5dad8600473e882efec5ac78a42dcc09e0ba0..0a5f09b379ab643c183006d43fe6c85b9f94ae02 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -655,8 +655,8 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv,
                if (dv->failfast == FlagClear)
                        disc.state &= ~(1 << MD_DISK_FAILFAST);
                remove_partitions(tfd);
-               if (update || dv->writemostly != FlagDefault
-                       || dv->failfast != FlagDefault) {
+               if (update || dv->writemostly != FlagDefault ||
+                   dv->failfast != FlagDefault) {
                        int rv = -1;
                        tfd = dev_open(dv->devname, O_RDWR);
                        if (tfd < 0) {
@@ -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) {
 
@@ -911,7 +899,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
 
        /* only add journal to array that supports journaling */
        if (dv->disposition == 'j') {
-               struct mdinfo mdi;
                struct mdinfo *mdp;
 
                mdp = sysfs_read(fd, NULL, GET_ARRAY_STATE);
@@ -928,11 +915,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
 
                sysfs_free(mdp);
 
-               tst->ss->getinfo_super(tst, &mdi, NULL);
-               if (mdi.journal_device_required == 0) {
-                       pr_err("%s does not support journal device.\n", devname);
-                       return -1;
-               }
                disc.raid_disk = 0;
        }
 
@@ -1012,17 +994,13 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
 
                Kill(dv->devname, NULL, 0, -1, 0);
                dfd = dev_open(dv->devname, O_RDWR | O_EXCL|O_DIRECT);
-               if (mdmon_running(tst->container_devnm))
-                       tst->update_tail = &tst->updates;
                if (tst->ss->add_to_super(tst, &disc, dfd,
                                          dv->devname, INVALID_SECTORS)) {
                        close(dfd);
                        close(container_fd);
                        return -1;
                }
-               if (tst->update_tail)
-                       flush_metadata_updates(tst);
-               else
+               if (!mdmon_running(tst->container_devnm))
                        tst->ss->sync_metadata(tst);
 
                sra = sysfs_read(container_fd, NULL, 0);
@@ -1307,8 +1285,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
@@ -1373,7 +1349,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;
 
@@ -1423,7 +1399,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)
@@ -1748,8 +1724,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;
        }
 
@@ -1763,7 +1741,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);
@@ -1771,7 +1750,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);