mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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: eb85c2410d ("f2fs: quota: fix to avoid warning in dquot_writeback_dquots()")
Signed-off-by: Jianan Huang <jnhuang95@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
3f72f38444
commit
3f140a60c9
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user