From patchwork Thu Dec 5 03:18:38 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Likai
X-Patchwork-Id: 11274095
Return-Path:
Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
[172.30.200.123])
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB3E513A4
for ;
Thu, 5 Dec 2019 03:21:43 +0000 (UTC)
Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mail.kernel.org (Postfix) with ESMTPS id 7FC6F21823
for ;
Thu, 5 Dec 2019 03:21:43 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FC6F21823
Authentication-Results: mail.kernel.org;
dmarc=none (p=none dis=none) header.from=h3c.com
Authentication-Results: mail.kernel.org;
spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com
Received: from pps.filterd (userp2130.oracle.com [127.0.0.1])
by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xB53A8Is092619;
Thu, 5 Dec 2019 03:21:25 GMT
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
by userp2130.oracle.com with ESMTP id 2wkfuujjhj-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Thu, 05 Dec 2019 03:21:24 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xB538bpC095928;
Thu, 5 Dec 2019 03:21:24 GMT
Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2])
by userp3020.oracle.com with ESMTP id 2wpp73aqk7-1
(version=TLSv1 cipher=AES256-SHA bits=256 verify=NO);
Thu, 05 Dec 2019 03:21:24 +0000
Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com)
by oss.oracle.com with esmtp (Exim 4.63)
(envelope-from )
id 1ichhj-00072j-8c; Wed, 04 Dec 2019 19:21:23 -0800
Received: from aserp3020.oracle.com ([141.146.126.70])
by oss.oracle.com with esmtp (Exim 4.63)
(envelope-from ) id 1ichgw-00071E-Qs
for ocfs2-devel@oss.oracle.com; Wed, 04 Dec 2019 19:20:34 -0800
Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1])
by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id
xB538TQh178843
for ; Thu, 5 Dec 2019 03:20:34 GMT
Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90])
by aserp3020.oracle.com with ESMTP id 2wp20frad2-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
for ; Thu, 05 Dec 2019 03:20:34 +0000
Received: from pps.filterd (userp2040.oracle.com [127.0.0.1])
by userp2040.oracle.com (8.16.0.27/8.16.0.27) with SMTP id
xB53APOP001513
for ; Thu, 5 Dec 2019 03:20:33 GMT
Received: from h3cspam01-ex.h3c.com (smtp.h3c.com [60.191.123.56])
by userp2040.oracle.com with ESMTP id 2wppr7jud3-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256
verify=FAIL)
for ; Thu, 05 Dec 2019 03:20:31 +0000
Received: from DAG2EX10-IDC.srv.huawei-3com.com ([10.8.0.73])
by h3cspam01-ex.h3c.com with ESMTPS id xB53Ib1n044983
(version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);
Thu, 5 Dec 2019 11:18:37 +0800 (GMT-8)
(envelope-from li.kai4@h3c.com)
Received: from DAG2EX07-IDC.srv.huawei-3com.com (10.8.0.70) by
DAG2EX10-IDC.srv.huawei-3com.com (10.8.0.73) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.1.1713.5; Thu, 5 Dec 2019 11:18:38 +0800
Received: from DAG2EX07-IDC.srv.huawei-3com.com ([::1]) by
DAG2EX07-IDC.srv.huawei-3com.com ([fe80::c439:37f7:8e24:31c4%9]) with
mapi id 15.01.1713.004; Thu, 5 Dec 2019 11:18:38 +0800
From: Likai
To: "mark@fasheh.com" ,
"jlbec@evilplan.org"
,
"joseph.qi@linux.alibaba.com"
Thread-Topic: [PATCH]ocfs2: flush journal to update log tail info after
journal recovery when mount
Thread-Index: AdWrGW9v+/VbLZ1ZS7SFl8sxrANTYw==
Date: Thu, 5 Dec 2019 03:18:38 +0000
Message-ID: <2014829f41f7447caa1701aa1efd09ce@h3c.com>
Accept-Language: en-US
Content-Language: zh-CN
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
x-originating-ip: [10.125.108.72]
x-sender-location: DAG2
MIME-Version: 1.0
X-DNSRBL:
X-MAIL: h3cspam01-ex.h3c.com xB53Ib1n044983
X-PDR: PASS
X-Source-IP: 60.191.123.56
X-ServerName: smtp.h3c.com
X-Proofpoint-SPF-Result: pass
X-Proofpoint-SPF-Record: v=spf1 ip4:60.191.123.56 ip4:60.191.123.50
ip4:221.12.31.13
ip4:221.12.31.56 ip4:122.225.128.134 -all
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9461
signatures=668685
X-Proofpoint-Spam-Details: rule=tap_spam_policies_notspam
policy=tap_spam_policies score=0
priorityscore=30 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0
spamscore=0 clxscore=300 lowpriorityscore=0 mlxscore=0 impostorscore=0
mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx
scancount=1 engine=8.0.1-1911140001 definitions=main-1912050021
X-Spam: Clean
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-1911140001 definitions=main-1912050021
Cc: "linux-kernel@vger.kernel.org" ,
"ocfs2-devel@oss.oracle.com"
Subject: [Ocfs2-devel] [PATCH]ocfs2: flush journal to update log tail info
after journal recovery when mount
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: ,
Sender: ocfs2-devel-bounces@oss.oracle.com
Errors-To: ocfs2-devel-bounces@oss.oracle.com
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9461
signatures=668685
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-1911140001 definitions=main-1912050021
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9461
signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
priorityscore=1501 malwarescore=0
suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011
lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001
definitions=main-1912050021
Hi, I meet a new problem that file may be lost althougth it is recorded in the jbd2 journal
with ocfs2 file system in one node scene. Can you give some suggestions for this problem
and modification patch?
Test method:
1. touch some files after mount
2. emergency restart
3. mount again, then log tail will not be updated
4. touch a new file and confirm that it is recorded in the journal area
5.emergency restart again
6. the new log will not be replayed becasuse its seq and blknum are not consistent with journal super block although it is an unbroken commit.
After analizing the codes, its cause is as follow:
Journal->j_flags will be set JBD2_ABORT in journal_init_common first.
if this flag is not cleared before journal_reset in journal recovery
scene, super log tail cannot be updated, then the new commit trans in
the journal may not be replayed because new commits recover old trans
area.
This exception happens when this lun is used by only one node. If it
is used by multi-nodes, other node will replay its journal and its
log tail info will be updated after recovery.
To fix this problem, use jbd2_journal_flush to update log tail as
ocfs2_replay_journal has done.
logdump:
Block 0: Journal Superblock
Seq: 0 Type: 4 (JBD2_SUPERBLOCK_V2)
Blocksize: 4096 Total Blocks: 32768 First Block: 1
First Commit ID: 13 Start Log Blknum: 1
Error: 0
Feature Compat: 0
Feature Incompat: 2 block64
Feature RO compat: 0
Journal UUID: 4ED3822C54294467A4F8E87D2BA4BC36
FS Share Cnt: 1 Dynamic Superblk Blknum: 0
Per Txn Block Limit Journal: 0 Data: 0
Block 1: Journal Commit Block
Seq: 14 Type: 2 (JBD2_COMMIT_BLOCK)
Block 2: Journal Descriptor
Seq: 15 Type: 1 (JBD2_DESCRIPTOR_BLOCK)
No. Blocknum Flags
0. 587 none
UUID: 00000000000000000000000000000000
1. 8257792 JBD2_FLAG_SAME_UUID
2. 619 JBD2_FLAG_SAME_UUID
3. 24772864 JBD2_FLAG_SAME_UUID
4. 8257802 JBD2_FLAG_SAME_UUID
5. 513 JBD2_FLAG_SAME_UUID JBD2_FLAG_LAST_TAG
...
Block 7: Inode
Inode: 8257802 Mode: 0640 Generation: 57157641 (0x3682809)
FS Generation: 2839773110 (0xa9437fb6)
CRC32: 00000000 ECC: 0000
Type: Regular Attr: 0x0 Flags: Valid
Dynamic Features: (0x1) InlineData
User: 0 (root) Group: 0 (root) Size: 7
Links: 1 Clusters: 0
ctime: 0x5de5d870 0x11104c61 -- Tue Dec 3 11:37:20.286280801 2019
atime: 0x5de5d870 0x113181a1 -- Tue Dec 3 11:37:20.288457121 2019
mtime: 0x5de5d870 0x11104c61 -- Tue Dec 3 11:37:20.286280801 2019
dtime: 0x0 -- Thu Jan 1 08:00:00 1970
...
Block 9: Journal Commit Block
Seq: 15 Type: 2 (JBD2_COMMIT_BLOCK)
syslog:
Dec 3 11:41:05 cvknode02 kernel: [ 2265.648622] ocfs2: File system on device (252,1) was not unmounted cleanly, recovering it.
Dec 3 11:41:05 cvknode02 kernel: [ 2265.649695] fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 0
Dec 3 11:41:05 cvknode02 kernel: [ 2265.650407] fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 1
Dec 3 11:41:05 cvknode02 kernel: [ 2265.650409] fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 2
Dec 3 11:41:05 cvknode02 kernel: [ 2265.650410] fs/jbd2/recovery.c:(jbd2_journal_recover, 278): JBD2: recovery, exit status 0, recovered transactions 13 to 13
Seq 15 is an unbroken commit, but it cannot be replayed, inode 8257802
is a new file and it will be lost. After test, it is ok now.
Signed-off-by: Kai Li
---
fs/ocfs2/journal.c | 8 ++++++++
1 file changed, 8 insertions(+)
????????????????????????????????????????
???
This e-mail and its attachments contain confidential information from New H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 1afe57f425a0..b8b9d26fa731 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1066,6 +1066,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed)
ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num);
+ if (replayed) {
+ /* wipe the journal */
+ jbd2_journal_lock_updates(journal->j_journal);
+ status = jbd2_journal_flush(journal->j_journal);
+ jbd2_journal_unlock_updates(journal->j_journal);
+ mlog(ML_NOTICE, "journal recovery complete, status=%d", status);
+ }
+
status = ocfs2_journal_toggle_dirty(osb, 1, replayed);
if (status < 0) {
mlog_errno(status);
-------------------------------------------------------------------------------------------------------------------------------------
?????????????????????????????????
????????????????????????????????????????