Linux 5.12 Lands Fix For File-System Corruption Caused By Swapfile Issue
Written by Michael Larabel in Linux Kernel on 3 March 2021 at 06:20 AM EST. 52 Comments
LINUX KERNEL --
For those wanting to help in testing out the Linux 5.12 kernel, at least it should no longer eat your data now if you rely on a swapfile.

The file-system corruption issue on Linux 5.12 Git noted last week and then followed up on yesterday when the corruption hit Intel's graphics CI systems and narrowed down to a set of swap-related changes, has now been resolved with today's latest Git code.

The fix isn't simply reverting the set of memory management patches talked about yesterday but fortunately a new patch was brewed that properly addresses the problem. Linux block maintainer and storage expert Jens Axboe was able to come up with a fix and got it punctually merged into the mainline tree.


The fix is about properly handling the swapfile read/write offset. Axboe noted in the patch, "We're not factoring in the start of the file for where to write and read the swapfile, which leads to very unfortunate side effects of writing where we should not be..." In other words, clobbering the underlying file-system where the system's swapfile is placed.

With that fix now in, we can get back to looking at Linux 5.12 performance changes and other more interesting testing than worrying about data loss.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week