Skip to content

Commit 48b0309

Browse files
chaseyugregkh
authored andcommitted
f2fs: fix to dirty inode for i_mode recovery
[ Upstream commit ca597bd ] As Seulbae Kim reported in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202637 We didn't recover permission field correctly after sudden power-cut, the reason is in setattr we didn't add inode into global dirty list once i_mode is changed, so latter checkpoint triggered by fsync will not flush last i_mode into disk, result in this problem, fix it. Reported-by: Seulbae Kim <[email protected]> Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 1158206 commit 48b0309

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

fs/f2fs/file.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
770770
{
771771
struct inode *inode = d_inode(dentry);
772772
int err;
773-
bool size_changed = false;
774773

775774
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
776775
return -EIO;
@@ -830,8 +829,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
830829
down_write(&F2FS_I(inode)->i_sem);
831830
F2FS_I(inode)->last_disk_size = i_size_read(inode);
832831
up_write(&F2FS_I(inode)->i_sem);
833-
834-
size_changed = true;
835832
}
836833

837834
__setattr_copy(inode, attr);
@@ -845,7 +842,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
845842
}
846843

847844
/* file size may changed here */
848-
f2fs_mark_inode_dirty_sync(inode, size_changed);
845+
f2fs_mark_inode_dirty_sync(inode, true);
849846

850847
/* inode change will produce dirty node pages flushed by checkpoint */
851848
f2fs_balance_fs(F2FS_I_SB(inode), true);

0 commit comments

Comments
 (0)