aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-02-23 09:48:27 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-20 09:17:04 +0200
commitc55d13d94f8ced4f3fc585b9e2ee12d9df5f3fc4 (patch)
tree2e37fac1d6e6311905c85ad21c9df6af311b8999
parent4fb70c2107e99b897d68b0bd820bebad6e5b1614 (diff)
downloadlinux-yocto-c55d13d94f8ced4f3fc585b9e2ee12d9df5f3fc4.tar.gz
linux-yocto-c55d13d94f8ced4f3fc585b9e2ee12d9df5f3fc4.tar.bz2
linux-yocto-c55d13d94f8ced4f3fc585b9e2ee12d9df5f3fc4.zip
f2fs: fix to dirty inode for i_mode recovery
[ Upstream commit ca597bddedd94906cd761d8be6a3ad21292725de ] 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 <seulbae@gatech.edu> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/f2fs/file.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ae2b45e75847..30ed43bce110 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -768,7 +768,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
{
struct inode *inode = d_inode(dentry);
int err;
- bool size_changed = false;
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
return -EIO;
@@ -843,8 +842,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
down_write(&F2FS_I(inode)->i_sem);
F2FS_I(inode)->last_disk_size = i_size_read(inode);
up_write(&F2FS_I(inode)->i_sem);
-
- size_changed = true;
}
__setattr_copy(inode, attr);
@@ -858,7 +855,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
}
/* file size may changed here */
- f2fs_mark_inode_dirty_sync(inode, size_changed);
+ f2fs_mark_inode_dirty_sync(inode, true);
/* inode change will produce dirty node pages flushed by checkpoint */
f2fs_balance_fs(F2FS_I_SB(inode), true);