• Jaegeuk Kim's avatar
    f2fs: increase i_size to avoid missing data · 8ef2af45
    Jaegeuk Kim authored
    When finsert is doing with dirting pages, we should increase i_size right away.
    Otherwise, the moved page is able to be dropped by the following
    filemap_write_and_wait_range before updating i_size.
    Especially, it can be done by
    	if ((page->index >= end_index + 1) || !offset)
    		goto out;
    in f2fs_write_data_page.
    
    This should resolve the below xfstests/091 failure reported by Dave.
    
    $ diff -u tests/generic/091.out /home/dave/src/xfstests-dev/results//f2fs/generic/091.out.bad
    --- tests/generic/091.out       2014-01-20 16:57:33.000000000 +1100
    +++ /home/dave/src/xfstests-dev/results//f2fs/generic/091.out.bad       2016-02-08 15:21:02.701375087 +1100
    @@ -1,7 +1,18 @@
     QA output created by 091
     fsx -N 10000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
    -fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
    -fsx -N 10000 -o 32768 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
    -fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
    -fsx -N 10000 -o 32768 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
    -fsx -N 10000 -o 128000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -W
    +mapped writes DISABLED
    +skipping insert range behind EOF
    +skipping insert range behind EOF
    +truncating to largest ever: 0x11e00
    +dowrite: write: Invalid argument
    +LOG DUMP (7 total operations):
    +1(  1 mod 256): SKIPPED (no operation)
    +2(  2 mod 256): SKIPPED (no operation)
    +3(  3 mod 256): FALLOC   0x2e0f2 thru 0x3134a  (0x3258 bytes) PAST_EOF
    +4(  4 mod 256): SKIPPED (no operation)
    +5(  5 mod 256): SKIPPED (no operation)
    +6(  6 mod 256): TRUNCATE UP    from 0x0 to 0x11e00
    +7(  7 mod 256): WRITE    0x73400 thru 0x79fff  (0x6c00 bytes) HOLE
    +Log of operations saved to "/mnt/test/junk.fsxops"; replay with --replay-ops
    +Correct content saved for comparison
    +(maybe hexdump "/mnt/test/junk" vs "/mnt/test/junk.fsxgood")
    Reported-by: default avatarDave Chinner <david@fromorbit.com>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    8ef2af45
file.c 44.7 KB