summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/inode.c
diff options
context:
space:
mode:
authorDaeho Jeong2018-01-11 03:26:19 +0100
committerJaegeuk Kim2018-01-19 07:09:12 +0100
commit9ac1e2d88d076aa1ae9e33d44a9bbc8ae3bfa791 (patch)
tree3136e84225b7e1c311cd38a20698f56af67973c1 /fs/f2fs/inode.c
parentf2fs: support FIEMAP_FLAG_XATTR (diff)
downloadkernel-qcow2-linux-9ac1e2d88d076aa1ae9e33d44a9bbc8ae3bfa791.tar.gz
kernel-qcow2-linux-9ac1e2d88d076aa1ae9e33d44a9bbc8ae3bfa791.tar.xz
kernel-qcow2-linux-9ac1e2d88d076aa1ae9e33d44a9bbc8ae3bfa791.zip
f2fs: prevent newly created inode from being dirtied incorrectly
Now, we invoke f2fs_mark_inode_dirty_sync() to make an inode dirty in advance of creating a new node page for the inode. By this, some inodes whose node page is not created yet can be linked into the global dirty list. If the checkpoint is executed at this moment, the inode will be written back by writeback_single_inode() and finally update_inode_page() will fail to detach the inode from the global dirty list because the inode doesn't have a node page. The problem is that the inode's state in VFS layer will become clean after execution of writeback_single_inode() and it's still linked in the global dirty list of f2fs and this will cause a kernel panic. So, we will prevent the newly created inode from being dirtied during the FI_NEW_INODE flag of the inode is set. We will make it dirty right after the flag is cleared. Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com> Signed-off-by: Youngjin Gil <youngjin.gil@samsung.com> Tested-by: Hobin Woo <hobin.woo@samsung.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/inode.c')
-rw-r--r--fs/f2fs/inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 234322889e65..1dc77a40d0ad 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -22,6 +22,9 @@
void f2fs_mark_inode_dirty_sync(struct inode *inode, bool sync)
{
+ if (is_inode_flag_set(inode, FI_NEW_INODE))
+ return;
+
if (f2fs_inode_dirtied(inode, sync))
return;