Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp802396ybl; Wed, 4 Dec 2019 11:08:13 -0800 (PST) X-Google-Smtp-Source: APXvYqx8vxyDAvqcvF3vybxPEjUkCGws+myPgMefNig3CXLGmv9pti5V1xV0+29Ea0znGvGuy7tD X-Received: by 2002:a9d:bcb:: with SMTP id 69mr3820249oth.290.1575486493542; Wed, 04 Dec 2019 11:08:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575486493; cv=none; d=google.com; s=arc-20160816; b=wsT/gMSHvo703mjZCFWx0l1+tBASj8Od+7LPpwgHTOGwgQNfdIpNJbL8hZsy4W58oF MpmsDnN7DYCvSmVJyMyYB9GiHdpZxu2q4A3HzKQMEnhG1CCrCxLGAR55JkD1U9YY9zmj EnH8qv54gNOKqyd7NXVbs+iMzdB7lTbenkanwOg5/5cbnDmtFXkvU0Kabmw6ZkRMdUl4 XXk4vNvaFYbTosVofzdTpY9/50oUZ7POBV376iJEcv2orTxHdUP5yq61374VcAeMohCC t8Qli+1oLlMOcruSR2AJSUxs5MTvAEq1GJvoip+F5hLHOLPH7ml4DBn93C+ccKTQHm9R xQ5w== 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=mbO83nWnITIPRXdcxl9uQ8amEw5ny5w8PLh3X5/Ot0o=; b=jyd6ste5ObjfLXUTc0enfNoMR/2h/2rQpiI3v2p+lUTACyL2xTEWk4xduUpWUpdqe6 Z3624zwXl0/ADRnKWxhiNntrmj68JPK3a1+ED7lSkq+5S+z9xt2iyGqu6iPS4g/xP/08 D8FRztT+eCsdPcrOewYA/nKX2TDjJPP8zw6K7CdbViGTZL7UJIxq0BboK96QF8PaLZh2 j7vdsRBZ3rsmjdw/W0C8ynMNOQ/NM5Ck4zTjjkY5U3E5muJIViW2okCvlntIdkq9vcGc wENBb5Wj1lGKDFlinEvZ+0ObRDYsUO5osuCgML0+uX/ILeA5GyNIAxFbFlwXbWuBXkwn lrNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R2hIR3ej; 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 z13si3885464oti.272.2019.12.04.11.08.01; Wed, 04 Dec 2019 11:08:13 -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=R2hIR3ej; 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 S1730465AbfLDSFy (ORCPT + 99 others); Wed, 4 Dec 2019 13:05:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:53002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730447AbfLDSFs (ORCPT ); Wed, 4 Dec 2019 13:05:48 -0500 Received: from localhost (unknown [217.68.49.72]) (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 A509D2073B; Wed, 4 Dec 2019 18:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482748; bh=PJgEEjbp1H8Kosvd8hBCuPEx4y/bSeGp4cUM17V5jY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R2hIR3ej53Kj0syEVOHwf3sm1PlM7DmR7B35xgymA3gW7lfgkUZk6d0oijv/woixK 4hn02ZD5/7pO94XS0hPR4aC5Xt63Fnpav722HqyBmxpkh3hATBytU+q05hqDkp+nb0 iJA3IK4MWN7Rgj/5VnSsktWjLyhB4iHsNg6Rx6QM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junxiao Bi , Yiwen Jiang , Joseph Qi , Jun Piao , Changwei Ge , Joel Becker , Mark Fasheh , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 119/209] ocfs2: clear journal dirty flag after shutdown journal Date: Wed, 4 Dec 2019 18:55:31 +0100 Message-Id: <20191204175331.300579581@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@linuxfoundation.org> User-Agent: quilt/0.66 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 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 f7fba58618ef3..2459ae9d2234f 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