]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
incremental, manage: do not verify if remove is safe
authorKinga Tanska <kinga.tanska@intel.com>
Tue, 27 Dec 2022 05:50:43 +0000 (06:50 +0100)
committerJes Sorensen <jes@trained-monkey.org>
Thu, 5 Jan 2023 03:37:30 +0000 (22:37 -0500)
Function is_remove_safe() was introduced to verify if removing
member device won't cause failed state of the array. This
verification should be used only with set-faulty command. Add
special mode indicating that Incremental removal was executed.
If this mode is used do not execute is_remove_safe() routine.

Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Incremental.c
Manage.c

index ff3548c0f20f055edc6370c8c58ac82319e0fbf5..09b94b9f58c17d501ddfc10f604d4f7a6331cba5 100644 (file)
@@ -1744,7 +1744,7 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
 
        memset(&devlist, 0, sizeof(devlist));
        devlist.devname = devname;
-       devlist.disposition = 'f';
+       devlist.disposition = 'I';
        /* for a container, we must fail each member array */
        if (ent->metadata_version &&
            strncmp(ent->metadata_version, "external:", 9) == 0) {
index 4d6e54b1e045a4ce5e12678f4c3c9b4bebf71934..6184d3f74a3973078aa2c8aac6a8d301d82e649f 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -1494,8 +1494,9 @@ int Manage_subdevs(char *devname, int fd,
                        /* Assume this is a kernel-internal name like 'sda1' */
                        int found = 0;
                        char dname[55];
-                       if (dv->disposition != 'r' && dv->disposition != 'f') {
-                               pr_err("%s only meaningful with -r or -f, not -%c\n",
+                       if (dv->disposition != 'r' && dv->disposition != 'f' &&
+                           dv->disposition != 'I') {
+                               pr_err("%s only meaningful with -r, -f or -I, not -%c\n",
                                        dv->devname, dv->disposition);
                                goto abort;
                        }
@@ -1647,7 +1648,7 @@ int Manage_subdevs(char *devname, int fd,
                                        close(sysfd);
                                goto abort;
                        }
-
+               case 'I': /* incremental fail */
                        if ((sysfd >= 0 && write(sysfd, "faulty", 6) != 6) ||
                            (sysfd < 0 && ioctl(fd, SET_DISK_FAULTY,
                                                rdev))) {