* [PATCH] f2fs: vm_unmap_ram() may be called from an invalid context
@ 2025-07-24 10:30 Jan Prusakowski
2025-07-24 12:51 ` [f2fs-dev] " Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Jan Prusakowski @ 2025-07-24 10:30 UTC (permalink / raw)
To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Jan Prusakowski
When testing F2FS with xfstests using UFS backed virtual disks the
kernel complains sometimes that f2fs_release_decomp_mem() calls
vm_unmap_ram() from an invalid context.
This patch modifies in_task() check inside f2fs_read_end_io() to also
check if interrupts are disabled. This ensures that pages are unmapped
asynchronously in an interrupt handler.
Fixes: bff139b (f2fs: handle decompress only post processing in softirq)
Signed-off-by: Jan Prusakowski <jprusakowski@google.com>
---
fs/f2fs/data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d1a2616d41be..0acc25f996b3 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -280,7 +280,7 @@ static void f2fs_read_end_io(struct bio *bio)
{
struct f2fs_sb_info *sbi = F2FS_F_SB(bio_first_folio_all(bio));
struct bio_post_read_ctx *ctx;
- bool intask = in_task();
+ bool intask = in_task() && !irqs_disabled();
iostat_update_and_unbind_ctx(bio);
ctx = bio->bi_private;
--
2.50.0.727.gbf7dc18ff4-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: vm_unmap_ram() may be called from an invalid context
2025-07-24 10:30 [PATCH] f2fs: vm_unmap_ram() may be called from an invalid context Jan Prusakowski
@ 2025-07-24 12:51 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2025-07-24 12:51 UTC (permalink / raw)
To: Jan Prusakowski, jaegeuk; +Cc: chao, linux-kernel, linux-f2fs-devel
Jan,
On 2025/7/24 18:30, Jan Prusakowski via Linux-f2fs-devel wrote:
> When testing F2FS with xfstests using UFS backed virtual disks the
> kernel complains sometimes that f2fs_release_decomp_mem() calls
> vm_unmap_ram() from an invalid context.
It will be better to include testcase & crash information in commit
message.
>
> This patch modifies in_task() check inside f2fs_read_end_io() to also
> check if interrupts are disabled. This ensures that pages are unmapped
> asynchronously in an interrupt handler.
>
> Fixes: bff139b (f2fs: handle decompress only post processing in softirq)
./scripts/checkpatch.pl will output below warning message:
WARNING: Please use correct Fixes: style 'Fixes: <12+ chars of sha1> ("<title line>")' - ie: 'Fixes: bff139b49d9f ("f2fs: handle decompress only post processing in softirq")'
Please use this instead:
Fixes: bff139b49d9f ("f2fs: handle decompress only post processing in softirq")
>
> Signed-off-by: Jan Prusakowski <jprusakowski@google.com>
Code part looks good to me, please feel free to add my RVB tag in next version:
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
> ---
> fs/f2fs/data.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index d1a2616d41be..0acc25f996b3 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -280,7 +280,7 @@ static void f2fs_read_end_io(struct bio *bio)
> {
> struct f2fs_sb_info *sbi = F2FS_F_SB(bio_first_folio_all(bio));
> struct bio_post_read_ctx *ctx;
> - bool intask = in_task();
> + bool intask = in_task() && !irqs_disabled();
>
> iostat_update_and_unbind_ctx(bio);
> ctx = bio->bi_private;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-24 12:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-24 10:30 [PATCH] f2fs: vm_unmap_ram() may be called from an invalid context Jan Prusakowski
2025-07-24 12:51 ` [f2fs-dev] " Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).