Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a01aa64 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

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: default avatarVelayudhan Pillai <vijay@cs.utexas.edu>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 5caf80f3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -956,8 +956,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);