f2fs: report error if quota off error during umount
PATCH 1/2 f2fs: report error if quota off error during umount
From: Yunlei He <[email protected]>
Now, we depend on fsck to ensure quota file data is ok, so we scan whole partition if checkpoint without umount flag. It's same for quota off error case, which may make quota file data inconsistent.
--- fs/f2fs/super.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
fs/f2fs/super.c +14 -3
@@ -1874,7 +1874,9 @@ static int f2fs_quota_off(struct super_block *sb, int type)if (!inode || !igrab (inode))return dquot_quota_off (sb, type); -f2fs_quota_sync (sb, type); + err =f2fs_quota_sync (sb, type); +if (err) + goto out_put; err =dquot_quota_off (sb, type);if (err ||f2fs_sb_has_quota_ino (sb))
@@ -1893,9 +1895,18 @@ static int f2fs_quota_off(struct super_block *sb, int type)void f2fs_quota_off_umount (struct super_block *sb) {int type; +int err; -for (type =0 ; type <MAXQUOTAS ; type++) -f2fs_quota_off (sb, type); +for (type =0 ; type <MAXQUOTAS ; type++) { + err =f2fs_quota_off (sb, type); +if (err) { +f2fs_msg (sb,KERN_ERR , +"Fail to turn off disk quota " +"(type: %d, err: %d), Please " +"run fsck to fix it." , type, err); +set_sbi_flag (F2FS_SB (sb),SBI_QUOTA_NEED_REPAIR ); + } + } }static int f2fs_dquot_commit (struct dquot *dquot)
Signature · 1 line
2.18.0.rc1
PATCH 2/2 f2fs: fix to avoid quota inode leak in ->put_super
generic/019 reports below error:
__quota_error: 1160 callbacks suppressed
Quota error (device zram1): write_blk: dquota write failed
Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed
Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed
Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed
Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed
Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota
VFS: Busy inodes after unmount of zram1. Self-destruct in 5 seconds. Have a nice day...
If we failed in below path due to fail to write dquot block, we will miss to release quota inode, fix it.
- f2fs_put_super
- f2fs_quota_off_umount
- f2fs_quota_off
- f2fs_quota_sync <-- failed
- dquot_quota_off <-- missed to call
--- fs/f2fs/super.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/f2fs/super.c +4 -2
@@ -1900,10 +1900,12 @@ void f2fs_quota_off_umount(struct super_block *sb)for (type =0 ; type <MAXQUOTAS ; type++) { err =f2fs_quota_off (sb, type);if (err) { +int ret =dquot_quota_off (sb, type); +f2fs_msg (sb,KERN_ERR ,"Fail to turn off disk quota " -"(type: %d, err: %d), Please " -"run fsck to fix it." , type, err); +"(type: %d, err: %d, ret:%d), Please " +"run fsck to fix it." , type, err, ret);set_sbi_flag (F2FS_SB (sb),SBI_QUOTA_NEED_REPAIR ); } }
Signature · 1 line
2.18.0.rc1
Jaegeuk Kim
maintainerRe: [PATCH 2/2] f2fs: fix to avoid quota inode leak in ->put_super
I merged as one. Please check dev. :)
Quoted 50 lines · Chao Yu
generic/019 reports below error:
__quota_error: 1160 callbacks suppressed
Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota
VFS: Busy inodes after unmount of zram1. Self-destruct in 5 seconds. Have a nice day...If we failed in below path due to fail to write dquot block, we will miss to release quota inode, fix it.
-
f2fs_put_super
-f2fs_quota_off_umount
-f2fs_quota_off
-f2fs_quota_sync<-- failed
-dquot_quota_off<-- missed to callSigned-off-by Chao Yu <[email protected]>--- fs/f2fs/super.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)fs/f2fs/super.c +4
-2@@ -1900,10 +1900,12 @@ void f2fs_quota_off_umount(struct super_block *sb)for (type =0 ; type <MAXQUOTAS ; type++) { err =f2fs_quota_off (sb, type);if (err) { +int ret =dquot_quota_off (sb, type); +f2fs_msg (sb,KERN_ERR ,"Fail to turn off disk quota " -"(type: %d, err: %d), Please " -"run fsck to fix it." , type, err); +"(type: %d, err: %d, ret:%d), Please " +"run fsck to fix it." , type, err, ret);set_sbi_flag (F2FS_SB (sb),SBI_QUOTA_NEED_REPAIR ); } }Signature · 1 line
2.18.0.rc1
Chao Yu
maintainerRe: [PATCH 2/2] f2fs: fix to avoid quota inode leak in ->put_super
I can see it in dev, thanks for merging. ;)
Quoted 53 lines · Jaegeuk Kim
I merged as one. Please check dev. :)
Quoted 50 lines · Chao Yu
generic/019 reports below error:
__quota_error: 1160 callbacks suppressed
Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1):write_blk: dquota write failed
Quota error (device zram1):qtree_write_dquot: Error -28 occurred while creating quota
VFS: Busy inodes after unmount of zram1. Self-destruct in 5 seconds. Have a nice day...If we failed in below path due to fail to write dquot block, we will miss to release quota inode, fix it.
-
f2fs_put_super
-f2fs_quota_off_umount
-f2fs_quota_off
-f2fs_quota_sync<-- failed
-dquot_quota_off<-- missed to callSigned-off-by Chao Yu <[email protected]>--- fs/f2fs/super.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)fs/f2fs/super.c +4
-2@@ -1900,10 +1900,12 @@ void f2fs_quota_off_umount(struct super_block *sb)for (type =0 ; type <MAXQUOTAS ; type++) { err =f2fs_quota_off (sb, type);if (err) { +int ret =dquot_quota_off (sb, type); +f2fs_msg (sb,KERN_ERR ,"Fail to turn off disk quota " -"(type: %d, err: %d), Please " -"run fsck to fix it." , type, err); +"(type: %d, err: %d, ret:%d), Please " +"run fsck to fix it." , type, err, ret);set_sbi_flag (F2FS_SB (sb),SBI_QUOTA_NEED_REPAIR ); } }Signature · 1 line
2.18.0.rc1