lkml.org 
[lkml]   [2023]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH -next v3] jbd2: Fix data missing when reusing bh which is ready to be checkpointed
From
Date
> 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.

\
 
 \ /
  Last update: 2023-03-26 23:34    [W:0.040 / U:1.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site