Commit c7ac88f
f2fs-tools: invalidate block device page cache before reading metadata
After the device is mounted, f2fs updates on-disk metadata without
updating the block device page cache. As a result, f2fs-tools may read
stale metadata from the page cache.
For example:
mount /dev/vdb /mnt/f2fs
touch mx // ino = 4
sync
dump.f2fs -i 4 /dev/vdb
touch mx2 // ino = 5
sync
dump.f2fs -i 5 /dev/vdb // block addr is 0
Since `dump.f2fs -i 4 /dev/vdb` has already populated the metadata area
into the block device page cache, the cached pages remain resident in
memory. After creating mx2, the page cache is not updated accordingly.
Therefore, `dump.f2fs -i 5 /dev/vdb` reads stale metadata, and the
physical block address of inode 5 is incorrectly reported as 0.
This patch issues a BLKFLSBUF ioctl to the block device before reading
metadata. The kernel then invalidates the block device page cache,
ensuring that subsequent reads fetch uptodate metadata from disk.
Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>1 parent 9330785 commit c7ac88f
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1016 | 1016 | | |
1017 | 1017 | | |
1018 | 1018 | | |
| 1019 | + | |
1019 | 1020 | | |
1020 | 1021 | | |
1021 | 1022 | | |
| |||
0 commit comments