f2fs: quota: fix stale lock holder on remount failure
PATCH 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.
Clear umount_lock_holder before returning -ENOMEM.
--- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/super.c +1 -0
@@ -2864,6 +2864,7 @@ 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]); + sbi->umount_lock_holder =NULL ;return -ENOMEM ; } }else {
Signature · 8 lines
2.43.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 26 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-ENOMEMThe direct return leaves
umount_lock_holderpointing at the failed remount context. A later checkpoint may then wrongly treat another context as thes_umountlock holder.Clear
umount_lock_holderbefore returning-ENOMEM.Fixes eb85c2410d6f ("f2fs: quota: fix to avoid warning in dquot_writeback_dquots()")Signed-off-by Jianan Huang <[email protected]>--- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+)fs/f2fs/super.c +0
-0
fs/f2fs/super.c static int __f2fs_remount(struct fs_context *fc, struct super_block *sb) · line 2868
Quoted 5 lines
fs/f2fs/super.c +1
-0@@ -2864,6 +2864,7 @@ 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]); + sbi->umount_lock_holder =NULL ;return -ENOMEM ;
How about adding restore_holder label, call goto restore_holder here?
Thanks,
fs/f2fs/super.c static int __f2fs_remount(struct fs_context *fc, struct super_block *sb) · line 2870
Quoted 2 lines
fs/f2fs/super.c +0
-0} }else {
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 36 lines · Chao Yu <[email protected]> 于2026年9月9日周三 19:15写道:
Quoted 26 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-ENOMEMThe direct return leaves
umount_lock_holderpointing at the failed remount context. A later checkpoint may then wrongly treat another context as thes_umountlock holder.Clear
umount_lock_holderbefore returning-ENOMEM.Fixes eb85c2410d6f ("f2fs: quota: fix to avoid warning in dquot_writeback_dquots()")Signed-off-by Jianan Huang <[email protected]>--- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+)fs/f2fs/super.c +0
-0fs/f2fs/super.c static int __f2fs_remount(struct fs_context *fc, struct super_block *sb) · line 2868
Quoted 5 lines
fs/f2fs/super.c +1
-0@@ -2864,6 +2864,7 @@ 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]); + sbi->umount_lock_holder =NULL ;return -ENOMEM ;How about adding
restore_holderlabel, call gotorestore_holderhere?
Quoted 1 line
Thanks,
Updated in v2,
Thanks,
Quoted 4 lines
fs/f2fs/super.c static int __f2fs_remount(struct fs_context *fc, struct super_block *sb) · line 2870
Quoted 3 lines
fs/f2fs/super.c +0
-0} }else {
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel