]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
metadump: Zero out unused portion of the AGFL
authorEric Sandeen <sandeen@sandeen.net>
Wed, 29 Jul 2015 23:17:43 +0000 (09:17 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 29 Jul 2015 23:17:43 +0000 (09:17 +1000)
mkfs.xfs doesn't zero the AGFL, so if it hasn't been
entirely used, metadump can pick up stale data.  Zero
the unused parts.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
db/metadump.c

index cd2edf056cebdcef154619b3e47035afa559c707..8520f66c137518661316b99cc5d11f2543c262f0 100644 (file)
@@ -2099,6 +2099,23 @@ scan_ag(
                if (stop_on_read_error)
                        goto pop_out;
        } else {
+               if (agf && zero_stale_data) {
+                       /* Zero out unused bits of agfl */
+                       int i;
+                        __be32  *agfl_bno;
+
+                       agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, iocur_top->bp);
+                       i = be32_to_cpu(agf->agf_fllast);
+
+                       for (;;) {
+                               if (++i == XFS_AGFL_SIZE(mp))
+                                       i = 0;
+                               if (i == be32_to_cpu(agf->agf_flfirst))
+                                       break;
+                               agfl_bno[i] = cpu_to_be32(NULLAGBLOCK);
+                       }
+                       iocur_top->need_crc = 1;
+               }
                if (write_buf(iocur_top))
                        goto pop_out;
        }