Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5616302img; Wed, 27 Mar 2019 11:47:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7BdCSWzjjuLgrL/XbSmbtjbE+viNTKEfUI0J/QqjpknvqSDj0hTochGlA0uDKlTdh3IqA X-Received: by 2002:a63:460a:: with SMTP id t10mr35060360pga.354.1553712435678; Wed, 27 Mar 2019 11:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553712435; cv=none; d=google.com; s=arc-20160816; b=GogujK33r9ry7P+MDUbpAAP/jcFrNvVZiAZTT47tVVsJTW7TehYeQQFYXWHErf5Vlp YkWMyYYemLmvszaHO2ZVx1ZSbn//I0Elob6Tv8DHr9u5jvN8rbzyzJyPBKor8zlUnDEQ OI6Mbh6EfaBUPqzLqv2/pW1Byvz4qGDEfYuahz/OzNaajwGZZ4MO2rDD3K/qAvwks7zd khPogWqX9b2SQuSs5vhiNLzljTzMNtOffxXkD+Cfx7fZf63oHbiP1v5f54uiBQ0s82bS pChFQY3dVY2JjwWuC+VV/mkKsNcynqNFgKJJpSEiNW8LPpFVJTgUG1N8z/Z8DRVh1Env hj8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JD554EeSmE/AQE6JLVqJQpLAtcZBuA/cmJZ2fi7KK4o=; b=yIgjBARB9KKx38NnOYo+e287GW/ffKh2EHApOADu8C976oqGjKJlaiZOLL/bntMteE O8iunYwpdiSg+rBP1xgxJj00KY5QR5LfNHlRCNxziAkj+gyss7bYXDUHucVj+UIf6kzN LmvCluSP18ZgzfJWIGwGb+oreN+tB55mSGHC9bWWVWEtHmjbc71lZ/AfWY/y4jKZ9SdV jaCq1vRCXWxPPMBIxbR7r2HWcEzPjdEa++wo3lTsUYEZZD2liHc34Gg3TSEd0P8vxdO9 GO/KT7iUKfT8QWObCvD56mAMGMVlgakgAEKjkxagTVmkQwyu56ASFcqv6swq7kJ3V2kD j5gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0BbsJwwG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si10189928pfp.156.2019.03.27.11.47.00; Wed, 27 Mar 2019 11:47:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0BbsJwwG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391256AbfC0So2 (ORCPT + 99 others); Wed, 27 Mar 2019 14:44:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:39102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391106AbfC0SVR (ORCPT ); Wed, 27 Mar 2019 14:21:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E8C532082F; Wed, 27 Mar 2019 18:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710876; bh=WL1ye6weSf789Gn69V70fqgfnS05W55G6SFX1+W99Dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0BbsJwwGw++ATsTSKmYWkhrvcNaYs+l2A9iXkQhU6vYDwQL+C6Njkxm6CtCNM3scP 9YwK06vVr5J0x6zK++gIPg6V2JNA+o9fbGjtlTtTxwdE06hDD4RbBxin1eEly0/MdL D29dRhVFputV37qUuOrfZJo3jB13hAUfCvE3o+0o= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: luojiajun , Theodore Ts'o , Sasha Levin , linux-ext4@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 21/87] jbd2: fix invalid descriptor block checksum Date: Wed, 27 Mar 2019 14:19:34 -0400 Message-Id: <20190327182040.17444-21-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327182040.17444-1-sashal@kernel.org> References: <20190327182040.17444-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: luojiajun [ Upstream commit 6e876c3dd205d30b0db6850e97a03d75457df007 ] In jbd2_journal_commit_transaction(), if we are in abort mode, we may flush the buffer without setting descriptor block checksum by goto start_journal_io. Then fs is mounted, jbd2_descriptor_block_csum_verify() failed. [ 271.379811] EXT4-fs (vdd): shut down requested (2) [ 271.381827] Aborting journal on device vdd-8. [ 271.597136] JBD2: Invalid checksum recovering block 22199 in log [ 271.598023] JBD2: recovery failed [ 271.598484] EXT4-fs (vdd): error loading journal Fix this problem by keep setting descriptor block checksum if the descriptor buffer is not NULL. This checksum problem can be reproduced by xfstests generic/388. Signed-off-by: luojiajun Signed-off-by: Theodore Ts'o Reviewed-by: Jan Kara Signed-off-by: Sasha Levin --- fs/jbd2/commit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 31f8ca046639..10ec27676191 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -700,9 +700,11 @@ void jbd2_journal_commit_transaction(journal_t *journal) the last tag we set up. */ tag->t_flags |= cpu_to_be16(JBD2_FLAG_LAST_TAG); - - jbd2_descriptor_block_csum_set(journal, descriptor); start_journal_io: + if (descriptor) + jbd2_descriptor_block_csum_set(journal, + descriptor); + for (i = 0; i < bufs; i++) { struct buffer_head *bh = wbuf[i]; /* -- 2.19.1