From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Jan Kara <jack@suse.cz>
Cc: <tytso@mit.edu>, <jack@suse.com>, <linux-ext4@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <yi.zhang@huawei.com>,
<libaokun1@huawei.com>, <zhanchengbin1@huawei.com>
Subject: Re: [PATCH -next v3] jbd2: Fix data missing when reusing bh which is ready to be checkpointed
Date: Tue, 10 Jan 2023 09:17:39 +0800 [thread overview]
Message-ID: <30b40bab-770d-3f77-2b9c-88984ae129e1@huawei.com> (raw)
In-Reply-To: <20230109152923.fvx57xucg2vggzp6@quack3>
> On Mon 09-01-23 21:45:45, Zhihao Cheng wrote >> Following process will make data lost and could lead to a
filesystem>> corrupted problem:>>
[...]
> Just a suggestion for rephrasing of the comment below
>
>> - /*
>> - * In any case we need to clean the dirty flag and we must
>> - * do it under the buffer lock to be sure we don't race
>> - * with running write-out.
>> + * We need to clean the dirty flag and we must do it under the
>> + * buffer lock to be sure we don't race with running write-out.
>> */
>> JBUFFER_TRACE(jh, "Journalling dirty buffer");
>> clear_buffer_dirty(bh);
>> + /*
>> + * Setting jbddirty after clearing buffer dirty is necessary.
>> + * Function jbd2_journal_restart() could keep buffer on
>> + * BJ_Reserved list until the transaction committing, then the
>> + * buffer won't be dirtied by jbd2_journal_refile_buffer()
>> + * after committing, the buffer couldn't fall on disk even
>> + * last checkpoint finished, which may corrupt filesystem.
>> + */
>
> As far as I understand you want to say:
> /*
> * The buffer is going to be added to BJ_Reserved list now
> * and nothing guarantees jbd2_journal_dirty_metadata()
> * will be ever called for it. So we need to set jbddirty
> * bit here to make sure the buffer is dirtied and written
> * out when the journaling machinery is done with it.
> */
>
>> set_buffer_jbddirty(bh);
>> }
>
Yes. The comment looks better than v3.
prev parent reply other threads:[~2023-01-10 1:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 13:45 Zhihao Cheng
2023-01-09 15:29 ` Jan Kara
2023-01-10 1:17 ` Zhihao Cheng [this message]
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=30b40bab-770d-3f77-2b9c-88984ae129e1@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=libaokun1@huawei.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
--cc=zhanchengbin1@huawei.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
all inboxes | Powered by JetHome®