From 3f140a60c92a5e2e9885adac70cd3686ba4ee19a Mon Sep 17 00:00:00 2001 From: Jianan Huang Date: Wed, 9 Sep 2026 19:46:14 +0800 Subject: [PATCH] f2fs: quota: fix stale lock holder on remount failure F2FS remount can fail while duplicating a journalled quota file name. f2fs_remount() - sbi->umount_lock_holder = current - kstrdup(F2FS_OPTION(sbi).s_qf_names[i]) : fails - free previously duplicated names - return -ENOMEM The direct return leaves umount_lock_holder pointing at the failed remount context. A later checkpoint may then wrongly treat another context as the s_umount lock holder. Add a restore_holder cleanup path and use it before returning -ENOMEM. Fixes: eb85c2410d6f ("f2fs: quota: fix to avoid warning in dquot_writeback_dquots()") Signed-off-by: Jianan Huang Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index f96abecb3c55..6a2f09c61dcd 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2877,7 +2877,8 @@ static int __f2fs_remount(struct fs_context *fc, struct super_block *sb) if (!org_mount_opt.s_qf_names[i]) { for (j = 0; j < i; j++) kfree(org_mount_opt.s_qf_names[j]); - return -ENOMEM; + err = -ENOMEM; + goto restore_holder; } } else { org_mount_opt.s_qf_names[i] = NULL; @@ -3138,6 +3139,7 @@ static int __f2fs_remount(struct fs_context *fc, struct super_block *sb) sbi->mount_opt = org_mount_opt; sb->s_flags = old_sb_flags; +restore_holder: sbi->umount_lock_holder = NULL; return err; }