From: Qu Wenruo <wqu@suse.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 4/5] btrfs: don't return VM_FAULT_SIGBUS on failure to set delalloc for mmap write
Date: Thu, 15 May 2025 06:31:29 +0930 [thread overview]
Message-ID: <0eca5d5d-0c41-434a-9784-c53ba10d7fbc@suse.com> (raw)
In-Reply-To: <1d26d64ba145f0bd53608c40c0fcd90d0f92b41d.1747222631.git.fdmanana@suse.com>
在 2025/5/14 21:08, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> 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.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> 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 9ecb9f3bd057..f6b32f24185c 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -1937,7 +1937,7 @@ static vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
> &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;
> }
>
next prev parent reply other threads:[~2025-05-14 21:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 10:29 [PATCH 0/3] btrfs: fix a bug and cleanups in btrfs_page_mkwrite() fdmanana
2025-05-14 10:29 ` [PATCH 1/3] btrfs: fix wrong start offset for delalloc space release during mmap write fdmanana
2025-05-14 10:38 ` Qu Wenruo
2025-05-14 10:41 ` Filipe Manana
2025-05-14 10:29 ` [PATCH 2/3] btrfs: pass true to btrfs_delalloc_release_space() at btrfs_page_mkwrite() fdmanana
2025-05-14 10:40 ` Qu Wenruo
2025-05-14 10:29 ` [PATCH 3/3] btrfs: simplify early error checking in btrfs_page_mkwrite() fdmanana
2025-05-14 10:50 ` Qu Wenruo
2025-05-14 10:57 ` Filipe Manana
2025-05-14 11:35 ` Filipe Manana
2025-05-14 11:38 ` [PATCH v2 0/5] btrfs: fix a bug and cleanups " fdmanana
2025-05-14 11:38 ` [PATCH v2 1/5] btrfs: fix wrong start offset for delalloc space release during mmap write fdmanana
2025-05-14 11:38 ` [PATCH v2 2/5] btrfs: pass true to btrfs_delalloc_release_space() at btrfs_page_mkwrite() fdmanana
2025-05-14 11:38 ` [PATCH v2 3/5] btrfs: simplify early error checking in btrfs_page_mkwrite() fdmanana
2025-05-14 21:01 ` Qu Wenruo
2025-05-14 11:38 ` [PATCH v2 4/5] btrfs: don't return VM_FAULT_SIGBUS on failure to set delalloc for mmap write fdmanana
2025-05-14 21:01 ` Qu Wenruo [this message]
2025-05-14 11:38 ` [PATCH v2 5/5] btrfs: use a single variable to track return value at btrfs_page_mkwrite() fdmanana
2025-05-14 21:02 ` Qu Wenruo
2025-05-15 13:19 ` [PATCH v2 0/5] btrfs: fix a bug and cleanups in btrfs_page_mkwrite() David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0eca5d5d-0c41-434a-9784-c53ba10d7fbc@suse.com \
--to=wqu@suse.com \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox