From patchwork Fri Jun 19 23:54:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 486939 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 815221401CB for ; Sat, 20 Jun 2015 09:55:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=thunk.org header.i=@thunk.org header.b=VgHPpJI0; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753082AbbFSXyV (ORCPT ); Fri, 19 Jun 2015 19:54:21 -0400 Received: from imap.thunk.org ([74.207.234.97]:45973 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbbFSXyU (ORCPT ); Fri, 19 Jun 2015 19:54:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=Message-Id:Date:Subject:Cc:To:From; bh=pW9NxI7snH2XRB4a2OOfs0hO3aaAowsJjwsb7waftV8=; b=VgHPpJI0cBHXMMTpDSpo1+dEaQY+U6VsX32ZQRymrSt8pEWS/2r65TgePwwzQkJ1NPEKZV0EiNogKw0sESmT7x3sIDDWTR2726pRVIOgLq6MDFSA5+qlOsm+Uk/axglDqV56kd0hcj8bUoAfo742aREgCkDL5ZuaH/27Mxk+u40=; Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.84) (envelope-from ) id 1Z6671-00011k-UI; Fri, 19 Jun 2015 23:54:19 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id A53BA58037E; Fri, 19 Jun 2015 19:54:19 -0400 (EDT) From: Theodore Ts'o To: Ext4 Developers List Cc: Theodore Ts'o Subject: [PATCH] e2fsck: skip checking the journal fields if the file system is mounted Date: Fri, 19 Jun 2015 19:54:14 -0400 Message-Id: <1434758054-26774-1-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 2.3.0 X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org When a file system with journal checksums is mounted, the journal checksum is only updated when the journal superblock is actually written to disk. But when a root file system is mounted read-only, e2fsck will get the in-memory version of the journal superblock, and the checksum is not necessarily going to be correct. Since we only allow the root file system to be checked while it is mounted read-only, and we won't be trying to replay the journal anyway. So we can skip the checking the journal superblock fields for mounted file systems. Signed-off-by: Theodore Ts'o --- e2fsck/unix.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 9ef4b1e..f75d90d 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1640,12 +1640,14 @@ failure: /* * Make sure the ext3 superblock fields are consistent. */ - retval = e2fsck_check_ext3_journal(ctx); - if (retval) { - com_err(ctx->program_name, retval, - _("while checking ext3 journal for %s"), - ctx->device_name); - fatal_error(ctx, 0); + if ((ctx->mount_flags & (EXT2_MF_MOUNTED | EXT2_MF_BUSY)) == 0) { + retval = e2fsck_check_ext3_journal(ctx); + if (retval) { + com_err(ctx->program_name, retval, + _("while checking ext3 journal for %s"), + ctx->device_name); + fatal_error(ctx, 0); + } } /*