From 986ad52128d74bc4e378ac720d42469be0cac646 Mon Sep 17 00:00:00 2001 From: RoyHuang Date: Mon, 14 Apr 2025 15:36:39 +0800 Subject: [PATCH] Fix journal not being released during umounting --- fs.c | 8 ++++++++ super.c | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs.c b/fs.c index 7bd6ac3..0dc4aa1 100644 --- a/fs.c +++ b/fs.c @@ -25,6 +25,14 @@ struct dentry *simplefs_mount(struct file_system_type *fs_type, /* Unmount a simplefs partition */ void simplefs_kill_sb(struct super_block *sb) { + struct simplefs_sb_info *sbi = SIMPLEFS_SB(sb); +#if SIMPLEFS_AT_LEAST(6, 9, 0) + if (sbi->s_journal_bdev_file) + fput(sbi->s_journal_bdev_file); +#elif SIMPLEFS_AT_LEAST(6, 7, 0) + if (sbi->s_journal_bdev_handle) + bdev_release(sbi->s_journal_bdev_handle); +#endif kill_block_super(sb); pr_info("unmounted disk\n"); diff --git a/super.c b/super.c index c489e27..2e4924f 100644 --- a/super.c +++ b/super.c @@ -372,12 +372,9 @@ static journal_t *simplefs_get_dev_journal(struct super_block *sb, } #if SIMPLEFS_AT_LEAST(6, 9, 0) sbi->s_journal_bdev_file = bdev_file; - pr_info("6.11 kernel"); #elif SIMPLEFS_AT_LEAST(6, 7, 0) sbi->s_journal_bdev_handle = bdev_handle; - pr_info("6.8 kernel"); #elif SIMPLEFS_AT_LEAST(5, 15, 0) - pr_info("5.15 kernel"); sbi->s_journal_bdev = bdev; #endif