Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4591124pja; Thu, 21 Nov 2019 22:26:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyQC3u8v76saGK2Egq+4OPNEV69HCgqDMREb/beUPBdXFvVe2jPQN5r4ZP31cncqvRc8jQx X-Received: by 2002:a17:906:c789:: with SMTP id cw9mr20424407ejb.40.1574404003318; Thu, 21 Nov 2019 22:26:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574404003; cv=none; d=google.com; s=arc-20160816; b=PxgxEl0uODEFPNdLxIiJaCBtTKV5kR14FbLHtrt3XoZ1We2OYsYNdC8LnSp0oDKIRC YH3hsjnVE9uLdsmBF7HkA6OWSb9MMM0VLPsgOrZAzToeLWMRu7Mc9hwASG0bwdN3z9o/ XoT98qaKi6czMzWHn/6vd8oCnN4wwZVtuPp7IDvD11oQiuhIso4UgXwaJ+fiPVBPF1T1 Z0YR7K7nKNE2GC/g4jqZLeOmznpbh+cZC2+6GNGzPpAQd6Uq0etRO5ug5ScNs4KeIxuT 0cNkO4rZfmKE1CQUh1dN0kKz7t5FTMo2nN0g71AXulXxj+kl7TwXJ6k11dLvUv0V3Zth ItNg== 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=QhUJGIOC9cyESjvPxiJtng7aI9SAHorfvlmFjF2H8Ig=; b=K6r0eo6e2O+nN9cxQp9EyX8anvhyhEx2b+s5Q46KRCrcXLr7EDdbFBF1ZN2rL1BRtK Ekn+1dIzoYs50Ywfzr6QX0d7joFJAVqShczYGrH1hDgLTUFM3z8k8HOVBK7h3iKOId7l zpR2R7rHyeGpRkbhtZ4KaFSednSr8mlsffPo9+C2r1CkobmwE5/JKyaSK3VOdJO/MuIE NDnP9ImOvZ+pLRL2BODA6Cj6M1QXDpF9uB8acOhXGMMloCmqCxnzDQBYBBwsA6tlZluK Po6dPSWES2x/KQcz2ejwzQi4ODwesDIqXnwjhiebrTtYf6ovV1ueUQaId/DMRfu7XkFJ bN9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VrRptPQA; 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 c31si3863870eda.343.2019.11.21.22.26.19; Thu, 21 Nov 2019 22:26:43 -0800 (PST) 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=VrRptPQA; 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 S1728426AbfKVFwK (ORCPT + 99 others); Fri, 22 Nov 2019 00:52:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:57486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728383AbfKVFwD (ORCPT ); Fri, 22 Nov 2019 00:52:03 -0500 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 0A2BE2070A; Fri, 22 Nov 2019 05:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574401923; bh=JD+nfwlfA6FTDIx8CSLBblnhU8b9zxdQYj7UMBcMqL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrRptPQADb2LBdWt24/YRC4VdycjVBV3FlpmotxvAxgrtd1+K+EG9nFD459UHAD02 LqdEBdD/PYgdCglMgFIZ9/gYkmJkRPQTF/di0azAE6iZ2kUo2JOOmW/8gmm81JHgkd s6aJ7gm4gADUnSOVRiYkWq+k3UDbJMGW8xKD0uO8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Junxiao Bi , Yiwen Jiang , Joseph Qi , Jun Piao , Changwei Ge , Joel Becker , Mark Fasheh , Andrew Morton , Linus Torvalds , Sasha Levin , ocfs2-devel@oss.oracle.com Subject: [PATCH AUTOSEL 4.19 152/219] ocfs2: clear journal dirty flag after shutdown journal Date: Fri, 22 Nov 2019 00:48:04 -0500 Message-Id: <20191122054911.1750-145-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122054911.1750-1-sashal@kernel.org> References: <20191122054911.1750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review 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: Junxiao Bi [ Upstream commit d85400af790dba2aa294f0a77e712f166681f977 ] Dirty flag of the journal should be cleared at the last stage of umount, if do it before jbd2_journal_destroy(), then some metadata in uncommitted transaction could be lost due to io error, but as dirty flag of journal was already cleared, we can't find that until run a full fsck. This may cause system panic or other corruption. Link: http://lkml.kernel.org/r/20181121020023.3034-3-junxiao.bi@oracle.com Signed-off-by: Junxiao Bi Reviewed-by: Yiwen Jiang Reviewed-by: Joseph Qi Cc: Jun Piao Cc: Changwei Ge Cc: Joel Becker Cc: Mark Fasheh Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/ocfs2/journal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index c492cbb2410f6..4c7e9b8dca316 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1018,7 +1018,8 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) mlog_errno(status); } - if (status == 0) { + /* Shutdown the kernel journal system */ + if (!jbd2_journal_destroy(journal->j_journal) && !status) { /* * Do not toggle if flush was unsuccessful otherwise * will leave dirty metadata in a "clean" journal @@ -1027,9 +1028,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) if (status < 0) mlog_errno(status); } - - /* Shutdown the kernel journal system */ - jbd2_journal_destroy(journal->j_journal); journal->j_journal = NULL; OCFS2_I(inode)->ip_open_count--; -- 2.20.1