From patchwork Fri Nov 16 08:58:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxiao Bi X-Patchwork-Id: 10685725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4A3714DB for ; Fri, 16 Nov 2018 09:05:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C07262CDCA for ; Fri, 16 Nov 2018 09:05:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF6162CDCE; Fri, 16 Nov 2018 09:05:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 523FE2CDCA for ; Fri, 16 Nov 2018 09:05:11 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAG94NPN012146; Fri, 16 Nov 2018 09:04:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : date : message-id : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : mime-version : content-type : content-transfer-encoding : sender; s=corp-2018-07-02; bh=equxv4BmX2WU7n3tvaeM3ttW7OLCS6/c0wuKCbivx54=; b=Gv4rcmXrrxQ+HVVE7PChXV02oKgVLlJHu2kzVi4H8rHP+54jHxsFK7vOu/ivI3oOIfP0 ZGtditS8xmH7q1588k+Hu30tHAcdMhKy1jgIJm0TOJg+hzNAbRNQ07XGJuKcuMPtVlac Ged2EhbISLl9acxZM0nQ51A7ZrUvfMpg7VbWrOfNGWvMkTvRQ7Sp7bIxxu4ajJNDr2g6 Ox+1EMO7rVzNyhzstFl3jzEZRtdzeRaxysY0g9qfYO0svnaiH9Dod7km8LqcFmNsPI2R XAHNZwbaX/A1wC5UReeLtZ7sel7mvodwCXk/QkjWNIqThvqgH7nE3lI2AKVmev7cLAxR Xw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2nr7cse2ax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Nov 2018 09:04:47 +0000 Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAG94hvK026482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Nov 2018 09:04:43 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1gNa3O-00025R-Vs; Fri, 16 Nov 2018 01:04:42 -0800 Received: from userv0022.oracle.com ([156.151.31.74]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1gNa32-00024e-SX for ocfs2-devel@oss.oracle.com; Fri, 16 Nov 2018 01:04:20 -0800 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wAG94Jr1032011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 16 Nov 2018 09:04:20 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAG94J2r008569 for ; Fri, 16 Nov 2018 09:04:19 GMT Received: from jubi-laptop.cn.oracle.com (/10.8.169.172) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 16 Nov 2018 01:04:19 -0800 From: Junxiao Bi To: ocfs2-devel@oss.oracle.com Date: Fri, 16 Nov 2018 16:58:47 +0800 Message-Id: <20181116085847.10066-1-junxiao.bi@oracle.com> X-Mailer: git-send-email 2.17.1 Subject: [Ocfs2-devel] [PATCH] ocfs2: clear journal dirty flag after shutdown journal X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9078 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811160083 X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Junxiao Bi --- fs/ocfs2/journal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index b63c97f4318e..25d678c92fbb 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1017,6 +1017,10 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) mlog_errno(status); } + /* Shutdown the kernel journal system */ + jbd2_journal_destroy(journal->j_journal); + journal->j_journal = NULL; + if (status == 0) { /* * Do not toggle if flush was unsuccessful otherwise @@ -1027,10 +1031,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) mlog_errno(status); } - /* Shutdown the kernel journal system */ - jbd2_journal_destroy(journal->j_journal); - journal->j_journal = NULL; - OCFS2_I(inode)->ip_open_count--; /* unlock our journal */