Skip to content

Commit 9149a5e

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: spread f2fs_set_inode_flags()
This patch changes codes as below: - use f2fs_set_inode_flags() to update i_flags atomically to avoid potential race. - synchronize F2FS_I(inode)->i_flags to inode->i_flags in f2fs_new_inode(). - use f2fs_set_inode_flags() to simply codes in f2fs_quota_{on,off}. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 2baf078 commit 9149a5e

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎fs/f2fs/f2fs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3422,7 +3422,7 @@ static inline void f2fs_set_encrypted_inode(struct inode *inode)
34223422
{
34233423
#ifdef CONFIG_F2FS_FS_ENCRYPTION
34243424
file_set_encrypt(inode);
3425-
inode->i_flags |= S_ENCRYPTED;
3425+
f2fs_set_inode_flags(inode);
34263426
#endif
34273427
}
34283428

‎fs/f2fs/namei.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
122122
if (F2FS_I(inode)->i_flags & F2FS_PROJINHERIT_FL)
123123
set_inode_flag(inode, FI_PROJ_INHERIT);
124124

125+
f2fs_set_inode_flags(inode);
126+
125127
trace_f2fs_new_inode(inode, 0);
126128
return inode;
127129

‎fs/f2fs/super.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,8 +1939,7 @@ static int f2fs_quota_on(struct super_block *sb, int type, int format_id,
19391939

19401940
inode_lock(inode);
19411941
F2FS_I(inode)->i_flags |= F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL;
1942-
inode_set_flags(inode, S_NOATIME | S_IMMUTABLE,
1943-
S_NOATIME | S_IMMUTABLE);
1942+
f2fs_set_inode_flags(inode);
19441943
inode_unlock(inode);
19451944
f2fs_mark_inode_dirty_sync(inode, false);
19461945

@@ -1965,7 +1964,7 @@ static int f2fs_quota_off(struct super_block *sb, int type)
19651964

19661965
inode_lock(inode);
19671966
F2FS_I(inode)->i_flags &= ~(F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL);
1968-
inode_set_flags(inode, 0, S_NOATIME | S_IMMUTABLE);
1967+
f2fs_set_inode_flags(inode);
19691968
inode_unlock(inode);
19701969
f2fs_mark_inode_dirty_sync(inode, false);
19711970
out_put:

0 commit comments

Comments
 (0)