]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_repair: skip free space checks when upgrading
authorDarrick J. Wong <djwong@kernel.org>
Wed, 7 Aug 2024 22:54:59 +0000 (15:54 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 14 Aug 2024 03:08:27 +0000 (20:08 -0700)
Add a debug knob to disable the free space checks when upgrading a
system.  This is extremely risky and will cause severe tire damage!!!

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
repair/globals.c
repair/globals.h
repair/phase2.c
repair/xfs_repair.c

index b24f780928ec1ed47bc28f25388e8b2353321045..0608ed9d7ae8078bf773fabff55441371b1c35e4 100644 (file)
@@ -48,6 +48,7 @@ char  *rt_name;               /* Name of realtime device */
 int    rt_spec;                /* Realtime dev specified as option */
 int    convert_lazy_count;     /* Convert lazy-count mode on/off */
 int    lazy_count;             /* What to set if to if converting */
+bool   skip_freesp_check_on_upgrade; /* do not enable */
 bool   features_changed;       /* did we change superblock feature bits? */
 bool   add_inobtcount;         /* add inode btree counts to AGI */
 bool   add_bigtime;            /* add support for timestamps up to 2486 */
index 29d64a0ea32aceb89dfd181f58154345517103e0..447063537e3f3a4ce713a87b7c6b63d94333ea36 100644 (file)
@@ -89,6 +89,7 @@ extern char   *rt_name;               /* Name of realtime device */
 extern int     rt_spec;                /* Realtime dev specified as option */
 extern int     convert_lazy_count;     /* Convert lazy-count mode on/off */
 extern int     lazy_count;             /* What to set if to if converting */
+extern bool    skip_freesp_check_on_upgrade; /* do not enable */
 extern bool    features_changed;       /* did we change superblock feature bits? */
 extern bool    add_inobtcount;         /* add inode btree counts to AGI */
 extern bool    add_bigtime;            /* add support for timestamps up to 2486 */
index 486b587989935adf1c05f36492955492951363c8..bd7631ac7b47094b7ea73566906cc93c7eea850d 100644 (file)
@@ -757,6 +757,8 @@ need_check_fs_free_space(
        struct xfs_mount                *mp,
        const struct check_state        *old)
 {
+       if (skip_freesp_check_on_upgrade)
+               return false;
        if (xfs_has_finobt(mp) && !(old->features & XFS_FEAT_FINOBT))
                return true;
        if (xfs_has_reflink(mp) && !(old->features & XFS_FEAT_REFLINK))
index f454f7a505e204fc6db188a75b12fc5eb2e756c8..0af4f35f0ff84035e356bb223c0aad32652aa469 100644 (file)
@@ -46,6 +46,7 @@ enum o_opt_nums {
        BLOAD_LEAF_SLACK,
        BLOAD_NODE_SLACK,
        NOQUOTA,
+       SKIP_FREESP_CHECK,
        O_MAX_OPTS,
 };
 
@@ -59,6 +60,7 @@ static char *o_opts[] = {
        [BLOAD_LEAF_SLACK]      = "debug_bload_leaf_slack",
        [BLOAD_NODE_SLACK]      = "debug_bload_node_slack",
        [NOQUOTA]               = "noquota",
+       [SKIP_FREESP_CHECK]     = "debug_skip_freesp_check_on_upgrade",
        [O_MAX_OPTS]            = NULL,
 };
 
@@ -327,6 +329,15 @@ process_args(int argc, char **argv)
                                case NOQUOTA:
                                        quotacheck_skip();
                                        break;
+                               case SKIP_FREESP_CHECK:
+                                       if (!val)
+                                               do_abort(
+               _("-o debug_skip_freesp_check_on_upgrade requires a parameter\n"));
+                                       skip_freesp_check_on_upgrade = (int)strtol(val, NULL, 0);
+                                       if (skip_freesp_check_on_upgrade)
+                                               do_log(
+               _("WARNING: Allowing filesystem upgrades to proceed without free space check.  THIS MAY DESTROY YOUR FILESYSTEM!!!\n"));
+                                       break;
                                default:
                                        unknown('o', val);
                                        break;