f2fs: quota: fix stale lock holder on remount failure
PATCH v2 1/1 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.
---
Changes since v1:
- add restore_holder cleanup label.
fs/f2fs/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/super.c +3 -1
@@ -2864,7 +2864,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 ;
@@ -3125,6 +3126,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; }
Signature · 8 lines
2.43.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 9 lines · Jianan Huang
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
Quoted 8 lines
The direct return leaves
umount_lock_holderpointing at the failed remount context. A later checkpoint may then wrongly treat another context as thes_umountlock holder.Add a
restore_holdercleanup path and use it before returning-ENOMEM.Fixes eb85c2410d6f ("f2fs: quota: fix to avoid warning in dquot_writeback_dquots()")Signed-off-by Jianan Huang <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 10 lines · On Wed, 9 Sep 2026 19:46:14 +0800 you wrote:
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[...]
Here is the summary with links:
- [f2fs-dev,v2] f2fs: quota: fix stale lock holder on remount failure
https://git.kernel.org/jaegeuk/f2fs/c/3f140a60c92a
You are awesome, thank you!
Signature · 10 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel