Commit ba8dac3
f2fs: fix to zero post-eof page
fstest reports a f2fs bug:
generic/363 42s ... [failed, exit status 1]- output mismatch (see /share/git/fstests/results//generic/363.out.bad)
--- tests/generic/363.out 2025-01-12 21:57:40.271440542 +0800
+++ /share/git/fstests/results//generic/363.out.bad 2025-05-19 19:55:58.000000000 +0800
@@ -1,2 +1,78 @@
QA output created by 363
fsx -q -S 0 -e 1 -N 100000
+READ BAD DATA: offset = 0xd6fb, size = 0xf044, fname = /mnt/f2fs/junk
+OFFSET GOOD BAD RANGE
+0x1540d 0x0000 0x2a25 0x0
+operation# (mod 256) for the bad data may be 37
+0x1540e 0x0000 0x2527 0x1
...
(Run 'diff -u /share/git/fstests/tests/generic/363.out /share/git/fstests/results//generic/363.out.bad' to see the entire diff)
Ran: generic/363
Failures: generic/363
Failed 1 of 1 tests
The root cause is user can update post-eof page via mmap [1], however, f2fs
missed to zero post-eof page in below operations, so, once it expands i_size,
then it will include dummy data locates previous post-eof page, so during
below operations, we need to zero post-eof page.
Operations which can include dummy data after previous i_size after expanding
i_size:
- write
- mapwrite [1]
- truncate
- fallocate
* preallocate
* zero_range
* insert_range
* collapse_range
- clone_range (doesn’t support in f2fs)
- copy_range (doesn’t support in f2fs)
[1] https://man7.org/linux/man-pages/man2/mmap.2.html 'BUG section'
Cc: [email protected]
Signed-off-by: Chao Yu <[email protected]>
Reviewed-by: Zhiguo Niu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>1 parent 6dea74e commit ba8dac3
1 file changed
+38
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
38 | 49 | | |
39 | 50 | | |
40 | 51 | | |
| |||
103 | 114 | | |
104 | 115 | | |
105 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
106 | 121 | | |
107 | 122 | | |
| 123 | + | |
108 | 124 | | |
109 | 125 | | |
110 | 126 | | |
| |||
1109 | 1125 | | |
1110 | 1126 | | |
1111 | 1127 | | |
| 1128 | + | |
| 1129 | + | |
1112 | 1130 | | |
1113 | 1131 | | |
1114 | 1132 | | |
| |||
1227 | 1245 | | |
1228 | 1246 | | |
1229 | 1247 | | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
1230 | 1252 | | |
1231 | 1253 | | |
1232 | 1254 | | |
| |||
1510 | 1532 | | |
1511 | 1533 | | |
1512 | 1534 | | |
| 1535 | + | |
| 1536 | + | |
1513 | 1537 | | |
1514 | 1538 | | |
1515 | 1539 | | |
| |||
1631 | 1655 | | |
1632 | 1656 | | |
1633 | 1657 | | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
1634 | 1662 | | |
1635 | 1663 | | |
1636 | 1664 | | |
| |||
1762 | 1790 | | |
1763 | 1791 | | |
1764 | 1792 | | |
| 1793 | + | |
| 1794 | + | |
1765 | 1795 | | |
1766 | 1796 | | |
1767 | 1797 | | |
| |||
1819 | 1849 | | |
1820 | 1850 | | |
1821 | 1851 | | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
1822 | 1856 | | |
1823 | 1857 | | |
1824 | 1858 | | |
| |||
4860 | 4894 | | |
4861 | 4895 | | |
4862 | 4896 | | |
| 4897 | + | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
4863 | 4901 | | |
4864 | 4902 | | |
4865 | 4903 | | |
| |||
0 commit comments