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

Commit e6e5f561 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: avoid writing 0'th page in volatile writes



The first page of volatile writes usually contains a sort of header information
which will be used for recovery.
(e.g., journal header of sqlite)

If this is written without other journal data, user needs to handle the stale
journal information.

Acked-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent eca76e78
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1177,8 +1177,10 @@ static int f2fs_write_data_page(struct page *page,
		goto redirty_out;
	if (f2fs_is_drop_cache(inode))
		goto out;
	if (f2fs_is_volatile_file(inode) && !wbc->for_reclaim &&
			available_free_memory(sbi, BASE_CHECK))
	/* we should not write 0'th page having journal header */
	if (f2fs_is_volatile_file(inode) && (!page->index ||
			(!wbc->for_reclaim &&
			available_free_memory(sbi, BASE_CHECK))))
		goto redirty_out;

	/* Dentry blocks are controlled by checkpoint */