diff options
author | Filipe Manana <fdmanana@suse.com> | 2024-11-29 15:25:30 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-01-02 12:34:24 +0300 |
commit | f6174bb982a831b96b8ebbd7c4aabe29d5ad97b7 (patch) | |
tree | d4b8758da91940e8821fa0d18b35b470321b20e5 /scripts/generate_rust_analyzer.py | |
parent | f6279a98db132da0cfff18712a1b06478c32007f (diff) | |
download | linux-f6174bb982a831b96b8ebbd7c4aabe29d5ad97b7.tar.xz |
btrfs: fix race with memory mapped writes when activating swap file
commit 0525064bb82e50d59543b62b9d41a606198a4a44 upstream.
When activating the swap file we flush all delalloc and wait for ordered
extent completion, so that we don't miss any delalloc and extents before
we check that the file's extent layout is usable for a swap file and
activate the swap file. We are called with the inode's VFS lock acquired,
so we won't race with buffered and direct IO writes, however we can still
race with memory mapped writes since they don't acquire the inode's VFS
lock. The race window is between flushing all delalloc and locking the
whole file's extent range, since memory mapped writes lock an extent range
with the length of a page.
Fix this by acquiring the inode's mmap lock before we flush delalloc.
CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions