]> git.karo-electronics.de Git - linux-beck.git/commitdiff
f2fs: avoid writing 0'th page in volatile writes
authorJaegeuk Kim <jaegeuk@kernel.org>
Thu, 14 Apr 2016 23:48:52 +0000 (16:48 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 26 Apr 2016 21:24:39 +0000 (14:24 -0700)
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>
fs/f2fs/data.c

index c29bcf4cfca139b68e83eaa35253cd562c5ba63c..e54489b970ae0297e98a3cc43d5a4da9af9a4774 100644 (file)
@@ -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 */