Skip to content

Commit 90b7c4b

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: fix to set noatime and immutable flag for quota file
We should set noatime bit for quota files, since no one cares about atime of quota file, and we should set immutalbe bit as well, due to nobody should write to the file through exported interfaces. Meanwhile this patch use inode_lock to avoid race condition during inode->i_flags, f2fs_inode->i_flags update. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 77e820e commit 90b7c4b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

fs/f2fs/super.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,6 +2748,7 @@ static int f2fs_quota_enable(struct super_block *sb, int type, int format_id,
27482748
{
27492749
struct inode *qf_inode;
27502750
unsigned long qf_inum;
2751+
unsigned long qf_flag = F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL;
27512752
int err;
27522753

27532754
BUG_ON(!f2fs_sb_has_quota_ino(F2FS_SB(sb)));
@@ -2763,7 +2764,15 @@ static int f2fs_quota_enable(struct super_block *sb, int type, int format_id,
27632764
}
27642765

27652766
/* Don't account quota for quota files to avoid recursion */
2767+
inode_lock(qf_inode);
27662768
qf_inode->i_flags |= S_NOQUOTA;
2769+
2770+
if ((F2FS_I(qf_inode)->i_flags & qf_flag) != qf_flag) {
2771+
F2FS_I(qf_inode)->i_flags |= qf_flag;
2772+
f2fs_set_inode_flags(qf_inode);
2773+
}
2774+
inode_unlock(qf_inode);
2775+
27672776
err = dquot_load_quota_inode(qf_inode, type, format_id, flags);
27682777
iput(qf_inode);
27692778
return err;

0 commit comments

Comments
 (0)