diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-04-15 02:48:52 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-04-27 00:24:39 +0300 |
commit | e6e5f5610d585551785ec654b6db9277b19a0664 (patch) | |
tree | 63020b453c38f5bdf74e06c75cf843a975993eb4 /fs/f2fs | |
parent | eca76e783cf5970db36edfda7e66487d897ea222 (diff) | |
download | linux-e6e5f5610d585551785ec654b6db9277b19a0664.tar.xz |
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: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/data.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c29bcf4cfca1..e54489b970ae 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1177,8 +1177,10 @@ write: 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 */ |