The patch titled Subject: ocfs2: clear journal dirty flag after shutdown journal has been added to the -mm tree. Its filename is ocfs2-clear-journal-dirty-flag-after-shutdown-journal.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/ocfs2-clear-journal-dirty-flag-after-shutdown-journal.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-clear-journal-dirty-flag-after-shutdown-journal.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Junxiao Bi <junxiao.bi@xxxxxxxxxx> Subject: ocfs2: clear journal dirty flag after shutdown journal 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. Link: http://lkml.kernel.org/r/20181121020023.3034-3-junxiao.bi@xxxxxxxxxx Signed-off-by: Junxiao Bi <junxiao.bi@xxxxxxxxxx> Reviewed-by: Yiwen Jiang <jiangyiwen@xxxxxxxxxx> Reviewed-by: Joseph Qi <jiangqi903@xxxxxxxxx> Cc: Jun Piao <piaojun@xxxxxxxxxx> Cc: Changwei Ge <ge.changwei@xxxxxxx> Cc: Joel Becker <jlbec@xxxxxxxxxxxx> Cc: Mark Fasheh <mfasheh@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/fs/ocfs2/journal.c~ocfs2-clear-journal-dirty-flag-after-shutdown-journal +++ a/fs/ocfs2/journal.c @@ -1017,7 +1017,8 @@ void ocfs2_journal_shutdown(struct ocfs2 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 @@ -1026,9 +1027,6 @@ void ocfs2_journal_shutdown(struct ocfs2 if (status < 0) mlog_errno(status); } - - /* Shutdown the kernel journal system */ - jbd2_journal_destroy(journal->j_journal); journal->j_journal = NULL; OCFS2_I(inode)->ip_open_count--; _ Patches currently in -mm which might be from junxiao.bi@xxxxxxxxxx are ocfs2-fix-panic-due-to-unrecovered-local-alloc.patch ocfs2-clear-journal-dirty-flag-after-shutdown-journal.patch ocfs2-dont-clear-bh-uptodate-for-block-read.patch