From: Brian Foster Date: Tue, 13 Oct 2015 23:58:24 +0000 (+1100) Subject: xfs_repair: process the log in no_modify mode X-Git-Tag: v4.3.0-rc1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ef257ccea845e0a47a82271b209a15baa9f62a6;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: process the log in no_modify mode 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 Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/repair/phase2.c b/repair/phase2.c index 11504e31e..72132ce0b 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -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"));