tag name | remount-fixes-5.16_2021-12-08 (8ed2044d5f8588073924528f96559c963faff9c3) |
tag date | 2021-12-08 15:14:34 -0800 |
tagged by | Darrick J. Wong <djwong@kernel.org> |
tagged object | commit 580d9368f9... |
xfs: fix data corruption when cycling ro/rw mounts
As part of a large customer escalation, I've been combing through the
XFS copy on write code to try to find sources of (mostly) silent data
corruption. I found a nasty problem in the remount code, wherein a ro
remount can race with file reader threads and fail to clean out cached
inode COW forks. A subsequent rw remount calls the COW staging extent
recovery code, which frees the space but does not update the records in
the cached inode COW forks. This leads to massive fs corruption.
The first patch in this series is the critical fix for the race
condition. The second patch is defensive in that it moves the COW
staging extent recovery so that it always happens at mount time to
protect us against future screwups.
v2: rework comments, move xfs_reflink_recover_cow to xfs_log_mount_finish
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEUzaAxoMeQq6m2jMV+H93GTRKtOsFAmGxPFoACgkQ+H93GTRK
tOv/RxAAjnDYixwkfh5UwX7AkAoeKuKdDVIoTIMozdkbG1+ZfIJy8TS+qmvU+q0e
qPM7PXzLrQqq+X5LFLnAceqJdk6uSgeXjyfuX+uix8SG3W0FTPp172Ugqy0CkEI1
LqJrSEUsdP705aIiWpL9Vi7eibx9dfflNhXh5gyltbcIjDXI56lBZiD8Hnq+frQ5
DVnvTmzGlHXJSeVc4OxAVmWNa7a7VVE4GhqL+OnztSidvXbL7O+to1Sjy0E/DefF
uMLMbp+TNUJRmOY49x8Ls9p4ZcI5qULgnjStAkm9M9EK1ElVzdjUIRO7/Y1ORLzG
sDWnwi5bRA8Bf1nEOVyyyvjU6Vmr3qs8c35aJBUfy1khUTIw6ySlJ2gxiphX8N1/
qg0rTQJfZzRqDclncEv+Yb3JYOScLW4zzH8J4y+cvxMIOZk2ApZ+tKCRT37Xric2
Vz9SLZOQBDjMHXBptYXXDkOloW4cYT8voD+fD85XD9U7BsbLUSo3LfGoD8wCETcq
Y3Fsb4+v9QeahB2eg7RnS+Kf40Big0+xMv+Xy4bpS1t3um4J7ridZ7+oZdZ3CsUm
RGy/woYezg2L63ymzB2Pau+S6/WK1+XkqUqd21l73BbZEIPTLL9tx/UJidFuPihI
q7QcEae9i9rylNrzDmETlL0xkqSZV0Amv00B+nyYlBnqSOBc/D4=
=5/3S
-----END PGP SIGNATURE-----