From d8cddf2a1d71ab9dea59822ccb9bbb780f50ce0a Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Wed, 14 May 2025 12:18:07 +0100 Subject: [PATCH] btrfs: don't return VM_FAULT_SIGBUS on failure to set delalloc for mmap write If the call to btrfs_set_extent_delalloc() fails we are always returning VM_FAULT_SIGBUS, which is odd since the error means "bad access" and the most likely cause for btrfs_set_extent_delalloc() is -ENOMEM, which should be translated to VM_FAULT_OOM. Instead of returning VM_FAULT_SIGBUS return vmf_error(ret2), which gives us a more appropriate return value, and we use that everywhere else too. Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 9ecb9f3bd057e..f6b32f24185c4 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1937,7 +1937,7 @@ again: &cached_state); if (ret2) { btrfs_unlock_extent(io_tree, page_start, page_end, &cached_state); - ret = VM_FAULT_SIGBUS; + ret = vmf_error(ret2); goto out_unlock; } -- 2.50.1