Commit c3e238b
f2fs: fix fsck inconsistency caused by FGGC of node block
During FGGC node block migration, fsck may incorrectly treat the
migrated node block as fsync-written data.
The reproduction scenario:
root@vm:/mnt/f2fs# seq 1 2048 | xargs -n 1 ./test_sync // write inline inode and sync
root@vm:/mnt/f2fs# rm -f 1
root@vm:/mnt/f2fs# sync
root@vm:/mnt/f2fs# f2fs_io gc_range // move data block in sync mode and not write CP
SPO, "fsck --dry-run" find inode has already checkpointed but still
with DENT_BIT_SHIFT set
The root cause is that GC does not clear the dentry mark and fsync mark
during node block migration, leading fsck to misinterpret them as
user-issued fsync writes.
In BGGC mode, node block migration is handled by f2fs_sync_node_pages(),
which guarantees the dentry and fsync marks are cleared before writing.
This patch move the set/clear of the fsync|dentry marks into
__write_node_folio to make the logic clearer, and ensures the
fsync|dentry mark is cleared in FGGC.
Cc: stable@kernel.org
Fixes: da011cc ("f2fs: move node pages only in victim section during GC")
Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>1 parent 019f9dd commit c3e238b
1 file changed
Lines changed: 13 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1727 | 1727 | | |
1728 | 1728 | | |
1729 | 1729 | | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
1733 | 1734 | | |
1734 | 1735 | | |
1735 | 1736 | | |
| |||
1802 | 1803 | | |
1803 | 1804 | | |
1804 | 1805 | | |
| 1806 | + | |
| 1807 | + | |
1805 | 1808 | | |
1806 | 1809 | | |
1807 | 1810 | | |
| |||
1868 | 1871 | | |
1869 | 1872 | | |
1870 | 1873 | | |
1871 | | - | |
| 1874 | + | |
1872 | 1875 | | |
1873 | 1876 | | |
1874 | 1877 | | |
| |||
1915 | 1918 | | |
1916 | 1919 | | |
1917 | 1920 | | |
| 1921 | + | |
1918 | 1922 | | |
1919 | 1923 | | |
1920 | 1924 | | |
| |||
1945 | 1949 | | |
1946 | 1950 | | |
1947 | 1951 | | |
1948 | | - | |
1949 | | - | |
1950 | | - | |
1951 | 1952 | | |
1952 | | - | |
| 1953 | + | |
1953 | 1954 | | |
1954 | 1955 | | |
1955 | 1956 | | |
| |||
1966 | 1967 | | |
1967 | 1968 | | |
1968 | 1969 | | |
1969 | | - | |
1970 | | - | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
1971 | 1973 | | |
1972 | 1974 | | |
1973 | 1975 | | |
| |||
2167 | 2169 | | |
2168 | 2170 | | |
2169 | 2171 | | |
2170 | | - | |
2171 | | - | |
2172 | | - | |
2173 | | - | |
| 2172 | + | |
2174 | 2173 | | |
2175 | 2174 | | |
2176 | 2175 | | |
| |||
0 commit comments