Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp988905yba; Thu, 4 Apr 2019 01:51:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxxLSNvl5zkibZzFSNFE+McyR3eYBxy+QaPp/qHfx/tHgAyXSylxEqVxiUFHrJioA6NF8S X-Received: by 2002:a63:ff18:: with SMTP id k24mr4569869pgi.140.1554367916637; Thu, 04 Apr 2019 01:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554367916; cv=none; d=google.com; s=arc-20160816; b=IDCGQ/UhWHbGi+IQOIx9QI8hyjanSMWmPBqR2csdzaaqL+zPnXrgPA1hz6GAubuXi8 K8B66KeU1i1OacNmrZ8g7o/7qdoHs6nETNjK0vdX4VdDxkp2DFLOwvlOKVQot4SDvba+ 0/AWrKerKk0SPEAztItke6kPSZ15Jbe6RRj8xDPXz0g1QhEUCJXqmpjUJr2l3sa2Sz0a o7xbrj9YKGAxFpez3ivjOo+b5uOFDW1yKm9mLVXi3io9HJzDIeZTMRlYc2P76AmEn/lh v7AV5wc3yDeW853Rot9/KGhM3PHcIs4iqg09VWUU9hyD1ULb5NGcCe8Rdyl4R8dPBRz9 t3Cg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HqymgCb28AUz1V0TEuJ6It/lp8gzrSwu/dMUIG/NzfI=; b=OkLpJKXKjEjVbsNNP6ZBJ0VmiWaPibMWWihJbcTDi7C2TnDiBqYTUzgfefky6r0WJv q8WtMwuQk9In2agH3cgS1lxGrVWuazJeXqLQbRbVd/CVoT9m8SVKJsoxpvqiU8hojAgR homSQfmx14+NGpc9b1fnbTBU+tzgRg9CoLPkBT/TC9eVChMz1KvssNa37JD4YpBS+9Ii MJxRVTUWx4X00bB0O3O30H4hDYjJjwOGe/LmEH/0DCruLwrGM5Msbm0YCgouQ/upV4yc NcHikKlpm0Um+R/39ZGKFpG4WoadpRtP4zoCkMN6e24CXhHJOH8I3j5kA3QBJe/Kp2y9 MBng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xKnBslE5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si16493717pgi.107.2019.04.04.01.51.41; Thu, 04 Apr 2019 01:51:56 -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=xKnBslE5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729128AbfDDIue (ORCPT + 99 others); Thu, 4 Apr 2019 04:50:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:51666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729104AbfDDIua (ORCPT ); Thu, 4 Apr 2019 04:50:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5ED9A2147C; Thu, 4 Apr 2019 08:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554367829; bh=Yc3MXC/0j1D1KCyuMLNOKqO9/TYQyysXvWdtZaoFwOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xKnBslE5sKc9jNhsQVLJpimPaFyi9XHJPjkhffiKBZ1gxiVlNhocHqZK3v0sXkRoO Mj/KtUf2MPVvY3wFY0DQBugBIj1w5mIiy+35x0z8WTrX3eWuW0ZFekP01inMnm27GU ntez1iEkf1FlO7k1sIE5yrV1U1Q85BVuSh1sgkac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, luojiajun , Theodore Tso , Jan Kara , Sasha Levin Subject: [PATCH 4.9 28/91] jbd2: fix invalid descriptor block checksum Date: Thu, 4 Apr 2019 10:47:12 +0200 Message-Id: <20190404084537.087264414@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084535.450029272@linuxfoundation.org> References: <20190404084535.450029272@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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