All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] discuss about jbd2 assertion in defragment path
@ 2023-02-10 10:04 Heming Zhao via Ocfs2-devel
  2023-02-14  2:52 ` Joseph Qi via Ocfs2-devel
  0 siblings, 1 reply; 12+ messages in thread
From: Heming Zhao via Ocfs2-devel @ 2023-02-10 10:04 UTC (permalink / raw)
  To: joseph.qi, ocfs2-devel; +Cc: jack

Hello Joseph,

I am sorry to wake up a long time ago thread.

All mails of this thread (my patch is [1]):
[1] https://oss.oracle.com/pipermail/ocfs2-devel/2022-May/000101.html
[2] https://oss.oracle.com/pipermail/ocfs2-devel/2022-June/000105.html
[3] https://oss.oracle.com/pipermail/ocfs2-devel/2022-June/000109.html
[4] https://oss.oracle.com/pipermail/ocfs2-devel/2022-June/000217.html

I re-checked ocfs2 defragmentation & jbd2 flow recently, I still think my
patch [1] is right. At least, the fixing code is correct, the patch commit
log needs to polish.

This bug has the same root cause of commit 7f27ec978b0e ("ocfs2: call
ocfs2_journal_access_di() before ocfs2_journal_dirty() in ocfs2_write_end_nolock()").
For this bug, jbd2_journal_restart() is called by ocfs2_split_extent() during
defragmenting, and it's not about "not enough credits" issue you ever said in [2].

I explain my thinking again in this mail.

the crash call flow:

ocfs2_defrag_extent //caller call it in while() loop.
 + handle = ocfs2_start_trans(osb, credits)
 + __ocfs2_move_extent
 |  + ocfs2_journal_access_di //[a]
 |  + ocfs2_split_extent      //[b]
 |  |  + if                   //[b.1]
 |  |  |   ocfs2_replace_extent_rec/ocfs2_split_and_insert
 |  |  + else
 |  |     ocfs2_try_to_merge_extent
 |  |
 |  + ocfs2_journal_dirty     //[c]
 |
 + ocfs2_commit_trans(osb, handle) //<== complete this handle

In my viewpoint, ocfs2_split_extent() is journal self-service function. I still
belive the two lines ([a] & [c]) in __ocfs2_move_extent() are totally useless.
In ocfs2_split_extent(), the code from the first code line to "if-else" code
area ([b.1]) doesn't need any journal protection, and we also could see there
are only read operations.

If we worry about data corruption after removing [a] & [c], (e.g: my eyes missed
some journal operations from [a] to [b.1]), we could only delete [c]. So the
fixed code seems (only remove line [c]):

ocfs2_defrag_extent
 + handle = ocfs2_start_trans(osb, credits)
 + __ocfs2_move_extent
 |  + ocfs2_journal_access_di //[a]  <-- keep it, but remove pair dirty action
 |  + ocfs2_split_extent      //[b]
 |     + if                   //[b.1]
 |     |   ocfs2_replace_extent_rec/ocfs2_split_and_insert
 |     + else
 |        ocfs2_try_to_merge_extent
 |
 + ocfs2_commit_trans(osb, handle)

Thanks,
Heming

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-02-16 14:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-10 10:04 [Ocfs2-devel] discuss about jbd2 assertion in defragment path Heming Zhao via Ocfs2-devel
2023-02-14  2:52 ` Joseph Qi via Ocfs2-devel
2023-02-14  4:33   ` Heming Zhao via Ocfs2-devel
2023-02-14 11:08     ` Joseph Qi via Ocfs2-devel
2023-02-14 11:48       ` Heming Zhao via Ocfs2-devel
2023-02-15  2:06         ` Joseph Qi via Ocfs2-devel
2023-02-15  6:20           ` Heming Zhao via Ocfs2-devel
2023-02-15  6:42             ` Joseph Qi via Ocfs2-devel
2023-02-15  7:29               ` Heming Zhao via Ocfs2-devel
2023-02-15 10:02               ` Heming Zhao via Ocfs2-devel
2023-02-15 12:04                 ` Joseph Qi via Ocfs2-devel
2023-02-16 14:58                   ` Heming Zhao via Ocfs2-devel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.