summaryrefslogtreecommitdiff
path: root/fs/f2fs/namei.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-04-25 07:43:01 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2018-05-31 21:31:48 +0300
commitade990f95eed818d24d6b6d48f4b4af0aaf55d97 (patch)
tree9b6906170131736d4899c801cf0e9c5235914ced /fs/f2fs/namei.c
parent8a29c1260e24e7c9c6ab138aa0017558d8b28208 (diff)
downloadlinux-ade990f95eed818d24d6b6d48f4b4af0aaf55d97.tar.xz
f2fs: enforce fsync_mode=strict for renamed directory
This is to give a option for user to be able to recover B/foo in the below case. mkdir A sync() rename(A, B) creat (B/foo) fsync (B/foo) ---crash--- Sugessted-by: Velayudhan Pillai <vijay@cs.utexas.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/namei.c')
-rw-r--r--fs/f2fs/namei.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index b5f404674cad..fef6e3ab2135 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -973,8 +973,11 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
f2fs_put_page(old_dir_page, 0);
f2fs_i_links_write(old_dir, false);
}
- if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT)
+ if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) {
add_ino_entry(sbi, new_dir->i_ino, TRANS_DIR_INO);
+ if (S_ISDIR(old_inode->i_mode))
+ add_ino_entry(sbi, old_inode->i_ino, TRANS_DIR_INO);
+ }
f2fs_unlock_op(sbi);