]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: process the log in no_modify mode
authorBrian Foster <bfoster@redhat.com>
Tue, 13 Oct 2015 23:58:24 +0000 (10:58 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 13 Oct 2015 23:58:24 +0000 (10:58 +1100)
xfs_repair does not zero the log in no_modify mode. In doing so, it also
skips the function that scans the log, locates the head/tail blocks and
sets the current LSN. Now that the log state is used beyond phase 2, the
log scan must occur regardless of whether no_modify mode is enabled or
not.

Update phase 2 to always execute the log scanning code. Push down the
no_modify checks into the log clearing helper such that the log is still
not modified in no_modify mode.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/phase2.c

index 11504e31e95c18bc85aa15921807ccae4dc6a7a1..72132ce0b34a667f0e215a5b69d0a825b8db20d0 100644 (file)
@@ -75,7 +75,7 @@ zero_log(xfs_mount_t *mp)
        _("zero_log: head block %" PRId64 " tail block %" PRId64 "\n"),
                                head_blk, tail_blk);
                }
-               if (head_blk != tail_blk) {
+               if (!no_modify && head_blk != tail_blk) {
                        if (zap_log) {
                                do_warn(_(
 "ALERT: The filesystem has valuable metadata changes in a log which is being\n"
@@ -93,6 +93,9 @@ zero_log(xfs_mount_t *mp)
                }
        }
 
+       if (no_modify)
+               return;
+
        libxfs_log_clear(log->l_dev, XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart),
                (xfs_extlen_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks),
                &mp->m_sb.sb_uuid,
@@ -136,10 +139,8 @@ phase2(
                do_log(_("Phase 2 - using internal log\n"));
 
        /* Zero log if applicable */
-       if (!no_modify)  {
-               do_log(_("        - zero log...\n"));
-               zero_log(mp);
-       }
+       do_log(_("        - zero log...\n"));
+       zero_log(mp);
 
        do_log(_("        - scan filesystem freespace and inode maps...\n"));