mbox series

[v3,00/12] ext4,jbd2: cleanup journal load and initialization process

Message ID 20230811063610.2980059-1-yi.zhang@huaweicloud.com
Headers show
Series ext4,jbd2: cleanup journal load and initialization process | expand

Message

Zhang Yi Aug. 11, 2023, 6:35 a.m. UTC
From: Zhang Yi <yi.zhang@huawei.com>

v2->v3:
 - Fix the potential overflow on journal space check in patch 7.
 - Rename ext4_get_journal_dev() to ext4_get_journal_blkdev() in patch 11.
v1->v2:
 - Fix the changelog in patch 1 and 2.
 - Simplify the comments for local functions in patch 6.
 - Remove the incorrect zero fast_commit blocks check in patch 7.
 - Fix a UAF problem in patch 11.

Hello,

This patch set cleanup the journal load and initialization process
(discussed and suggested by Ted in [1]). Firstly, move reading of the
journal superblock from jbd2_journal_load() and jbd2_journal_wipe()
early to journal_init_common(), and completely drop the kludgy call of
journal_get_superblock() in jbd2_journal_check_used_features(). Then
cleanup the ext4_get_journal() and ext4_get_dev_journal(), making their
initialization process and error handling process more clear, and return
proper errno if some bad happens. Finally rename those two functions to
jbd2_open_{dev,inode}_journal. This patch set has passed
'kvm-xfstests -g auto'.

[1] https://lore.kernel.org/linux-ext4/20230617185057.GA343628@mit.edu/

Thanks,
Yi.

Zhang Yi (12):
  jbd2: move load_superblock() dependent functions
  jbd2: move load_superblock() into journal_init_common()
  jbd2: don't load superblock in jbd2_journal_check_used_features()
  jbd2: checking valid features early in journal_get_superblock()
  jbd2: open code jbd2_verify_csum_type() helper
  jbd2: cleanup load_superblock()
  jbd2: add fast_commit space check
  jbd2: cleanup journal_init_common()
  jbd2: drop useless error tag in jbd2_journal_wipe()
  jbd2: jbd2_journal_init_{dev,inode} return proper error return value
  ext4: cleanup ext4_get_dev_journal() and ext4_get_journal()
  ext4: ext4_get_{dev}_journal return proper error value

 fs/ext4/super.c    | 154 ++++++++-------
 fs/jbd2/journal.c  | 466 +++++++++++++++++++++------------------------
 fs/ocfs2/journal.c |   8 +-
 3 files changed, 300 insertions(+), 328 deletions(-)

Comments

Theodore Ts'o Aug. 17, 2023, 2:47 p.m. UTC | #1
On Fri, 11 Aug 2023 14:35:58 +0800, Zhang Yi wrote:
> v2->v3:
>  - Fix the potential overflow on journal space check in patch 7.
>  - Rename ext4_get_journal_dev() to ext4_get_journal_blkdev() in patch 11.
> v1->v2:
>  - Fix the changelog in patch 1 and 2.
>  - Simplify the comments for local functions in patch 6.
>  - Remove the incorrect zero fast_commit blocks check in patch 7.
>  - Fix a UAF problem in patch 11.
> 
> [...]

Applied, thanks!

[01/12] jbd2: move load_superblock() dependent functions
        commit: 29a511e49f33426c8d24700db4842234a84678b2
[02/12] jbd2: move load_superblock() into journal_init_common()
        commit: c30713084ba5b6fa343129613ec349ea91f0c458
[03/12] jbd2: don't load superblock in jbd2_journal_check_used_features()
        commit: 9600f3e5cfd0360b10c271149032c77917baedc5
[04/12] jbd2: checking valid features early in journal_get_superblock()
        commit: e4adf8b837087b5bb57fff6827e10ec877a50f64
[05/12] jbd2: open code jbd2_verify_csum_type() helper
        commit: 18dad509e7bd3189ac1e7f7904faf1561a908871
[06/12] jbd2: cleanup load_superblock()
        commit: 054d9c8fef14d476f1a9c6434de86813c5990052
[07/12] jbd2: add fast_commit space check
        commit: 0dbc759ae9971568af24def1b01d5b1aa87bd546
[08/12] jbd2: cleanup journal_init_common()
        commit: 49887e47a5262cc7b87d547de57a21a072c6ea5e
[09/12] jbd2: drop useless error tag in jbd2_journal_wipe()
        commit: d9a45496019a73c240bd22912ae18a04b8496364
[10/12] jbd2: jbd2_journal_init_{dev,inode} return proper error return value
        commit: c279913275eb9fcab79fe713925dcf9b037070cf
[11/12] ext4: cleanup ext4_get_dev_journal() and ext4_get_journal()
        commit: e89c6fc9b191318238c2e211ee02be2fe943a69d
[12/12] ext4: ext4_get_{dev}_journal return proper error value
        commit: 99d6c5d892bfff3be40f83ec34d91d562125afd4

Best regards,