From: Joseph Qi <jiangqi903@gmail.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH V2 2/2] ocfs2: clear journal dirty flag after shutdown journal
Date: Tue, 20 Nov 2018 08:59:02 +0800 [thread overview]
Message-ID: <c37e7938-724f-8ae0-db87-c501bd77431a@gmail.com> (raw)
In-Reply-To: <83789dc5-54d6-9b4d-59fd-132bcbf3eb69@oracle.com>
On 18/11/20 07:26, Junxiao Bi wrote:
> Hi Joseph,
>
> On 11/19/18 8:34 PM, Joseph Qi wrote:
>> Hi Junxiao,
>>
>> On 18/11/19 16:07, Junxiao Bi wrote:
>>> 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 <junxiao.bi@oracle.com>
>>> Cc: Yiwen Jiang <jiangyiwen@huawei.com>
>>> Cc: Jun Piao <piaojun@huawei.com>
>>> ---
>>> ? fs/ocfs2/journal.c | 6 ++----
>>> ? 1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>>> ? V1 -> V2:
>>> ? pointed by Yiwen, need check return value of jbd2_journal_destroy
>>>
>>> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
>>> index 13f8e097babf..b51bb873441f 100644
>>> --- a/fs/ocfs2/journal.c
>>> +++ b/fs/ocfs2/journal.c
>>> @@ -986,7 +986,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
>>> @@ -995,9 +996,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);
>> Now we will write journal inode after journal has been destroyed.
>> I wonder if it the right way as expected.
>
> The destroyed journal here was managed by jbd2 and located in the data section of ocfs2 journal inode, after clean up the data, clear flag in the inode, this seemed right way to go.
>
It makes sense.
Reviewed-by: Joseph Qi <jiangqi903@gmail.com>
> Thanks,
>
> Junxiao.
>
>>
>> Thanks,
>> Joseph
>>
>>> ????? journal->j_journal = NULL;
>>> ? ????? OCFS2_I(inode)->ip_open_count--;
>>>
next prev parent reply other threads:[~2018-11-20 0:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-19 8:07 [Ocfs2-devel] [PATCH 1/2] ocfs2: fix panic due to unrecovered local alloc Junxiao Bi
2018-11-19 8:07 ` [Ocfs2-devel] [PATCH V2 2/2] ocfs2: clear journal dirty flag after shutdown journal Junxiao Bi
2018-11-19 12:29 ` jiangyiwen
2018-11-19 12:34 ` Joseph Qi
2018-11-19 23:26 ` Junxiao Bi
2018-11-20 0:59 ` Joseph Qi [this message]
2018-11-19 9:49 ` [Ocfs2-devel] [PATCH 1/2] ocfs2: fix panic due to unrecovered local alloc piaojun
2018-11-19 23:33 ` Junxiao Bi
2018-11-19 12:19 ` jiangyiwen
2018-11-19 12:25 ` Joseph Qi
2018-11-19 23:35 ` Junxiao Bi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c37e7938-724f-8ae0-db87-c501bd77431a@gmail.com \
--to=jiangqi903@gmail.com \
--cc=ocfs2-devel@oss.oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).