Skip to content

Commit 4645f7a

Browse files
authored
Merge pull request #72 from RoyWFHuang/Bug/Memleak
Fix journal not being released during umounting
2 parents 68a6cb7 + 986ad52 commit 4645f7a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

fs.c

+8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ struct dentry *simplefs_mount(struct file_system_type *fs_type,
2525
/* Unmount a simplefs partition */
2626
void simplefs_kill_sb(struct super_block *sb)
2727
{
28+
struct simplefs_sb_info *sbi = SIMPLEFS_SB(sb);
29+
#if SIMPLEFS_AT_LEAST(6, 9, 0)
30+
if (sbi->s_journal_bdev_file)
31+
fput(sbi->s_journal_bdev_file);
32+
#elif SIMPLEFS_AT_LEAST(6, 7, 0)
33+
if (sbi->s_journal_bdev_handle)
34+
bdev_release(sbi->s_journal_bdev_handle);
35+
#endif
2836
kill_block_super(sb);
2937

3038
pr_info("unmounted disk\n");

super.c

-3
Original file line numberDiff line numberDiff line change
@@ -372,12 +372,9 @@ static journal_t *simplefs_get_dev_journal(struct super_block *sb,
372372
}
373373
#if SIMPLEFS_AT_LEAST(6, 9, 0)
374374
sbi->s_journal_bdev_file = bdev_file;
375-
pr_info("6.11 kernel");
376375
#elif SIMPLEFS_AT_LEAST(6, 7, 0)
377376
sbi->s_journal_bdev_handle = bdev_handle;
378-
pr_info("6.8 kernel");
379377
#elif SIMPLEFS_AT_LEAST(5, 15, 0)
380-
pr_info("5.15 kernel");
381378
sbi->s_journal_bdev = bdev;
382379
#endif
383380

0 commit comments

Comments
 (0)