f2fs: quota: do not mount as RDWR without QUOTA if quota feature enabled
PATCH 1/3 f2fs: quota: do not mount as RDWR without QUOTA if quota feature enabled
If quota feature is enabled, quota is on by default. However, if CONFIG_QUOTA is not built in kernel, dquot entries will not get updated, which leads to quota inconsistency.
--- fs/f2fs/super.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
fs/f2fs/super.c +7 -6
@@ -346,12 +346,6 @@ static int f2fs_check_quota_options(struct f2fs_sb_info *sbi) "QUOTA feature is enabled, so ignore jquota_fmt"); F2FS_OPTION(sbi).s_jquota_fmt = 0; } -if (f2fs_sb_has_quota_ino (sbi->sb) &&f2fs_readonly (sbi->sb)) { -f2fs_msg (sbi->sb,KERN_INFO , -"Filesystem with quota feature cannot be mounted RDWR " -"without CONFIG_QUOTA" ); -return -1 ; - }return 0 ; }#endif
@@ -774,6 +768,13 @@ static int parse_options(struct super_block *sb, char *options)#ifdef CONFIG_QUOTA if (f2fs_check_quota_options (sbi))return -EINVAL ; +#else +if (f2fs_sb_has_quota_ino (sbi->sb) && !f2fs_readonly (sbi->sb)) { +f2fs_msg (sbi->sb,KERN_INFO , +"Filesystem with quota feature cannot be mounted RDWR " +"without CONFIG_QUOTA" ); +return -EINVAL ; + }#endif if (F2FS_IO_SIZE_BITS (sbi) && !test_opt (sbi,LFS )) {
Signature · 6 lines
2.17.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
PATCH 2/3 f2fs: quota: decrease the lock granularity of statfs_project
According to fs/quota/dquot.c, dq_data_lock' protects mem_dqinfo structures and modifications of dquot pointers in the inode, and dquot->dq_dqb_lock' protects data from dq_dqb.
We should use dquot->dq_dqb_lock in statfs_project instead of dq_dat_lock.
--- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/super.c +2 -2
@@ -1118,7 +1118,7 @@ static int f2fs_statfs_project(struct super_block *sb, dquot =dqget (sb, qid);if (IS_ERR (dquot))return PTR_ERR (dquot); -spin_lock (&dq_data_lock); +spin_lock (&dquot->dq_dqb_lock); limit = (dquot->dq_dqb.dqb_bsoftlimit ? dquot->dq_dqb.dqb_bsoftlimit :
@@ -1141,7 +1141,7 @@ static int f2fs_statfs_project(struct super_block *sb, (buf->f_files - dquot->dq_dqb.dqb_curinodes) : 0; } -spin_unlock (&dq_data_lock); +spin_unlock (&dquot->dq_dqb_lock);dqput (dquot);return 0 ; }
Signature · 6 lines
2.17.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH 2/3] f2fs: quota: decrease the lock granularity of statfs_project
Quoted 8 lines · Sheng Yong
According to
fs/quota/dquot.c,dq_data_lock' protects mem_dqinfo structures and modifications of dquot pointers in the inode, anddquot->dq_dqb_lock' protects data fromdq_dqb.We should use
dquot->dq_dqb_lockinstatfs_projectinstead ofdq_dat_lock.Signed-off-by Sheng Yong <[email protected]>
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
PATCH 3/3 f2fs: quota: fix incorrect error message and comments
In reply to Sheng Yong--- fs/f2fs/checkpoint.c | 5 ++++- fs/f2fs/recovery.c | 2 +- fs/f2fs/super.c | 5 +---- 3 files changed, 6 insertions(+), 6 deletions(-)
fs/f2fs/checkpoint.c +4 -1
@@ -645,7 +645,10 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi)/* Needed for iput() to work correctly and not trash data */ sbi->sb->s_flags |=SB_ACTIVE ; -/* Turn on quotas so that they are updated correctly */ +/* +* Turn on quotas which were not enabled for read-only mounts if +* filesystem has quota feature, so that they are updated correctly. +*/ quota_enabled =f2fs_enable_quota_files (sbi, s_flags &SB_RDONLY );#endif
fs/f2fs/recovery.c +1 -1
@@ -628,7 +628,7 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)#endif if (s_flags &SB_RDONLY ) { -f2fs_msg (sbi->sb,KERN_INFO ,"orphan cleanup on readonly fs" ); +f2fs_msg (sbi->sb,KERN_INFO ,"fsync data recover on readonly fs" ); sbi->sb->s_flags &= ~SB_RDONLY ; }
fs/f2fs/super.c +1 -4
@@ -2970,10 +2970,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_root_inode;#ifdef CONFIG_QUOTA -/* -* Turn on quotas which were not enabled for read-only mounts if -* filesystem has quota feature, so that they are updated correctly. -*/ +/* Enable quota usage during mount */ if (f2fs_sb_has_quota_ino (sb) && !f2fs_readonly (sb)) { err =f2fs_enable_quotas (sb);if (err) {
Signature · 6 lines
2.17.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Chao Yu
maintainerRe: [PATCH 3/3] f2fs: quota: fix incorrect error message and comments
Quoted 28 lines · Sheng Yong
Signed-off-by Sheng Yong <[email protected]>--- fs/f2fs/checkpoint.c | 5 ++++- fs/f2fs/recovery.c | 2 +- fs/f2fs/super.c | 5 +---- 3 files changed, 6 insertions(+), 6 deletions(-)fs/f2fs/checkpoint.c +4
-1@@ -645,7 +645,10 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi)/* Needed for iput() to work correctly and not trash data */ sbi->sb->s_flags |=SB_ACTIVE ; -/* Turn on quotas so that they are updated correctly */ +/* +* Turn on quotas which were not enabled for read-only mounts if +* filesystem has quota feature, so that they are updated correctly. +*/ quota_enabled =f2fs_enable_quota_files (sbi, s_flags &SB_RDONLY );#endif fs/f2fs/recovery.c +0
-0
fs/f2fs/recovery.c int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) · line 631
Quoted 5 lines
fs/f2fs/recovery.c +1
-1@@ -628,7 +628,7 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)#endif if (s_flags &SB_RDONLY ) { -f2fs_msg (sbi->sb,KERN_INFO ,"orphan cleanup on readonly fs" ); +f2fs_msg (sbi->sb,KERN_INFO ,"fsync data recover on readonly fs" );
I remember Yunlei has fix this print info in another patch.
Thanks,
Quoted 10 lines
fs/f2fs/recovery.c +0
-0sbi->sb->s_flags &= ~SB_RDONLY ; }fs/f2fs/super.c +0
-0@@ -2970,10 +2970,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_root_inode;
fs/f2fs/super.c static int f2fs_fill_super(struct super_block *sb, void *data, int silent) · line 2976
Quoted 10 lines
fs/f2fs/super.c +1
-4#ifdef CONFIG_QUOTA -/* -* Turn on quotas which were not enabled for read-only mounts if -* filesystem has quota feature, so that they are updated correctly. -*/ +/* Enable quota usage during mount */ if (f2fs_sb_has_quota_ino (sb) && !f2fs_readonly (sb)) { err =f2fs_enable_quotas (sb);if (err) {
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH 3/3] f2fs: quota: fix incorrect error message and comments
Quoted 31 lines · Chao Yu
Quoted 30 lines · Sheng Yong
Signed-off-by Sheng Yong <[email protected]>--- fs/f2fs/checkpoint.c | 5 ++++- fs/f2fs/recovery.c | 2 +- fs/f2fs/super.c | 5 +---- 3 files changed, 6 insertions(+), 6 deletions(-)fs/f2fs/checkpoint.c +4
-1@@ -645,7 +645,10 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi)/* Needed for iput() to work correctly and not trash data */ sbi->sb->s_flags |=SB_ACTIVE ; -/* Turn on quotas so that they are updated correctly */ +/* +* Turn on quotas which were not enabled for read-only mounts if +* filesystem has quota feature, so that they are updated correctly. +*/ quota_enabled =f2fs_enable_quota_files (sbi, s_flags &SB_RDONLY );#endif fs/f2fs/recovery.c +0
-0@@ -628,7 +628,7 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)#endif
Quoted 6 lines
fs/f2fs/recovery.c int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only) · line 631
Quoted 3 lines
fs/f2fs/recovery.c +1
-1if (s_flags &SB_RDONLY ) { -f2fs_msg (sbi->sb,KERN_INFO ,"orphan cleanup on readonly fs" ); +f2fs_msg (sbi->sb,KERN_INFO ,"fsync data recover on readonly fs" );I remember Yunlei has fix this print info in another patch.
Hi, Chao,
I checked the list just now, yes, Yunlei has already submitted a patch to fix the error message. Please ignore this :)
thanks
Quoted 12 lines
Thanks,
Quoted 10 lines
fs/f2fs/recovery.c +0
-0sbi->sb->s_flags &= ~SB_RDONLY ; }fs/f2fs/super.c +0
-0@@ -2970,10 +2970,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_root_inode;
Quoted 13 lines
fs/f2fs/super.c static int f2fs_fill_super(struct super_block *sb, void *data, int silent) · line 2976
Quoted 10 lines
fs/f2fs/super.c +1
-4#ifdef CONFIG_QUOTA -/* -* Turn on quotas which were not enabled for read-only mounts if -* filesystem has quota feature, so that they are updated correctly. -*/ +/* Enable quota usage during mount */ if (f2fs_sb_has_quota_ino (sb) && !f2fs_readonly (sb)) { err =f2fs_enable_quotas (sb);if (err) {.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
PATCH v2 1/1 f2fs: quota: fix incorrect comments
In reply to Sheng Yong--- fs/f2fs/checkpoint.c | 5 ++++- fs/f2fs/super.c | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/checkpoint.c +4 -1
@@ -661,7 +661,10 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi)/* Needed for iput() to work correctly and not trash data */ sbi->sb->s_flags |=SB_ACTIVE ; -/* Turn on quotas so that they are updated correctly */ +/* +* Turn on quotas which were not enabled for read-only mounts if +* filesystem has quota feature, so that they are updated correctly. +*/ quota_enabled =f2fs_enable_quota_files (sbi, s_flags &SB_RDONLY );#endif
fs/f2fs/super.c +1 -4
@@ -2968,10 +2968,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_root_inode;#ifdef CONFIG_QUOTA -/* -* Turn on quotas which were not enabled for read-only mounts if -* filesystem has quota feature, so that they are updated correctly. -*/ +/* Enable quota usage during mount */ if (f2fs_sb_has_quota_ino (sb) && !f2fs_readonly (sb)) { err =f2fs_enable_quotas (sb);if (err) {
Signature · 6 lines
2.17.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH v2] f2fs: quota: fix incorrect comments
Quoted 1 line · Sheng Yong
Signed-off-by Sheng Yong <[email protected]>
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 5 lines · Sheng Yong
If quota feature is enabled, quota is on by default. However, if
CONFIG_QUOTAis not built in kernel, dquot entries will not get updated, which leads to quota inconsistency.Signed-off-by Sheng Yong <[email protected]>
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot