Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5653393img; Wed, 27 Mar 2019 12:30:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxWJHjIWLV60yzPf8jrMRrV78OBXQ/GNsN8xp6PUAtDkDfDmId6F27vLMQT257k9q4rPQa X-Received: by 2002:a62:19c3:: with SMTP id 186mr35684058pfz.172.1553715047720; Wed, 27 Mar 2019 12:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553715047; cv=none; d=google.com; s=arc-20160816; b=ax5uxx7ToOf/MS5+rK8KzgJTkxH5fD7XYLYIlAmkHxDZ6ujksEsBdBq4rjdbQ51GSE udmL2KrfatLXLmyJNiwfuB7SsV3LU8gv4V1vcvHT3M0FM96ChoYR+g2CPnMFqeAfTHjq 66i/x4zIrgniA1DBYuqJtRoJvBGBBAHy1Dp98LK8SrzdTJ/IsPRU7Gv9poSOzBJheKRr RM6s29VnieYshRe4W7zzWcQ42U+e/Z2Frdq6WC89JXvFIFOY3Z+aez+a1h4nCaFV47Uv hj0qW/w0HPWQ+63uJg5IHm1ZM0DYje6NWvWIN+K/l2Qhwk5kI8MW9z6JtrMTcXxIYa+U LDgQ== 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=hxEcBuC2MBG+J9KpnsTDIrhFO2i6NP2Ye43nIdl+s/g=; b=SE+2/zA1/J50W2jJoakYQMTn9Ol3JZf5EJ1mWjvX+P53eiwUCoqBTjRMTzhek57qzN J7tB3MoHWmC+zvZnf0rXNgi2xcvM3uDijpaKMobepJVHh80m0oWef050WtD7EAyQdkuW D3ui0DKURpRdQb+jX95fmfvfJnGQ++K9w+gbzS/81lgDWb3Jk0zULbrmfTSAEMrNqzXE 3wA0jX+Rcsj4y2CI7MGXJol/D7l9S5jkv5Ou1YE+7UYVMxoIlDL7sOWEWj3nYZSd2ZbV UajGXgo/YmRUeK4/TiJk5IA+X+tbmm6gtTjYbhR+n20o7qhz6GoQV35eXZkufWOv1ml/ Cfaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KE14pBeO; 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 v67si16478794pgb.536.2019.03.27.12.30.32; Wed, 27 Mar 2019 12:30:47 -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=KE14pBeO; 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 S2387593AbfC0TaB (ORCPT + 99 others); Wed, 27 Mar 2019 15:30:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:43966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732672AbfC0SDj (ORCPT ); Wed, 27 Mar 2019 14:03:39 -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 038F42183E; Wed, 27 Mar 2019 18:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709818; bh=vOWr6nCvbaiF3lCzop1vDUGXuj5KMLJjAQGHE5o7Rks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KE14pBeOt3Oolsruv8TsytJ47J77/UdF8oO2LpMarwBhcXYhKmXcpIc17NgVWAqmd YhLKgygog5kz1jYGqaGMn3S5fzO8Cx+OgGGL0ijEeRqy1EitnqolEKXPq7GePuFaKW tMjAXR2+Uu0MjXB8kue+74Y92RGXvPOldolHmaD4= 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 5.0 057/262] jbd2: fix invalid descriptor block checksum Date: Wed, 27 Mar 2019 13:58:32 -0400 Message-Id: <20190327180158.10245-57-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-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 2eb55c3361a8..efd0ce9489ae 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -694,9 +694,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