From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_SBL,URIBL_SBL_A,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6278AC43603 for ; Wed, 4 Dec 2019 18:05:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B71C2089C for ; Wed, 4 Dec 2019 18:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482757; bh=PJgEEjbp1H8Kosvd8hBCuPEx4y/bSeGp4cUM17V5jY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Csurf/Mih4M8R6J+LPL4qjlR2RpGyVbqshqNBPD3JXkfPMPAxEGBfeu5kEPIK5Gun RVhgArTS7KjY2Gfr/SX+h/N7DyOpHjp7ZplY5F8zXjZBziGr0lb+nIPIMOJVlbshfy rNRfB8Y/YhodOwA8vZ6RrQm1lFlMcwK26tgtzQn4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730470AbfLDSFz (ORCPT ); Wed, 4 Dec 2019 13:05:55 -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