* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-11-09 15:11 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-11-09 15:40 ` bugzilla-daemon--- via Linux-f2fs-devel
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-11-09 15:11 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
Chao Yu (chao@kernel.org) changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |chao@kernel.org
--- Comment #1 from Chao Yu (chao@kernel.org) ---
Hi, thanks for your report.
Can you please help to check max_hw_discard_sectors parameter of dm device
via "cat /sys/block/<device_name>/queue/max_hw_discard_sectors"?
I doubt max_discard_blocks becomes zero in __submit_discard_cmd(), result
in that __blkdev_issue_discard() fails to allocate bio.
__submit_discard_cmd()
{
unsigned int max_discard_blocks =
SECTOR_TO_BLOCK(bdev_max_discard_sectors(bdev));
...
while () {
...
if (len > max_discard_blocks) {
len = max_discard_blocks;
last = false;
}
...
} else {
err = __blkdev_issue_discard(bdev,
SECTOR_FROM_BLOCK(start),
SECTOR_FROM_BLOCK(len),
GFP_NOFS, &bio);
}
...
f2fs_bug_on(sbi, !bio); // trigger warning here and panic below
}
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
2024-11-09 15:11 ` [f2fs-dev] [Bug 219484] " bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-11-09 15:40 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-11-10 11:36 ` bugzilla-daemon--- via Linux-f2fs-devel
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-11-09 15:40 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
--- Comment #2 from piergiorgio.sartor@nexgo.de ---
Thanks for the prompt reply.
Actually, there is no "max_hw_discard_sectors", but only a
"max_discard_segments", which is "1" (for all DM devices).
It is also "1" for the underlying SSD (/dev/sda).
The "discard_max_bytes", as well as the "discard_max_hw_bytes", is "2147450880"
everywhere.
Hope this helps,
bye,
pg
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
2024-11-09 15:11 ` [f2fs-dev] [Bug 219484] " bugzilla-daemon--- via Linux-f2fs-devel
2024-11-09 15:40 ` bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-11-10 11:36 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-11-10 14:44 ` bugzilla-daemon--- via Linux-f2fs-devel
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-11-10 11:36 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
--- Comment #3 from piergiorgio.sartor@nexgo.de ---
One more thing, possibly important.
When I create the snapshot, with the working kernel, while
"max_discard_segments" is still "1", the other two, "discard_max_bytes" and
"discard_max_hw_bytes" are both "0", instead of "2147450880".
Hope this helps,
bye,
pg
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
` (2 preceding siblings ...)
2024-11-10 11:36 ` bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-11-10 14:44 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-11-10 15:42 ` bugzilla-daemon--- via Linux-f2fs-devel
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-11-10 14:44 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
--- Comment #4 from Chao Yu (chao@kernel.org) ---
Do we have any chance to apply this and try to check whether it can fix this
bug?
From: Chao Yu <chao@kernel.org>
---
fs/f2fs/segment.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 10ec69cbae68..86a22447b89b 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1314,11 +1314,6 @@ static int __submit_discard_cmd(struct f2fs_sb_info
*sbi,
unsigned long flags;
bool last = true;
- if (len > max_discard_blocks) {
- len = max_discard_blocks;
- last = false;
- }
-
(*issued)++;
if (*issued == dpolicy->max_requests)
last = true;
--
2.40.1
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
` (3 preceding siblings ...)
2024-11-10 14:44 ` bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-11-10 15:42 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-11-21 9:50 ` bugzilla-daemon--- via Linux-f2fs-devel
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-11-10 15:42 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
--- Comment #5 from piergiorgio.sartor@nexgo.de ---
Thanks for the support.
Difficult to check the patch, I'll have to see with this PC what can I do (not
so free to use).
Which kernel would be this 6.11.5/6/7?
Any other way to test?
For example, using sysfs interface?
What about the difference with 6.9.12 (working) with this not working?
I cannot promise, but I'll have a look on patching.
Thanks again,
bye,
pg
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
` (4 preceding siblings ...)
2024-11-10 15:42 ` bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-11-21 9:50 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-11-21 9:54 ` bugzilla-daemon--- via Linux-f2fs-devel
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-11-21 9:50 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
--- Comment #6 from Chao Yu (chao@kernel.org) ---
Sorry for long delay due to I'm out of office.
Now, I can reproduce this bug w/ below testcase:
- pvcreate /dev/vdb
- vgcreate myvg1 /dev/vdb
- lvcreate -L 1024m -n mylv1 myvg1
- mount /dev/myvg1/mylv1 /mnt/f2fs
- dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=20
- sync
- rm /mnt/f2fs/file
- sync
- lvcreate -L 1024m -s -n mylv1-snapshot /dev/myvg1/mylv1
- umount /mnt/f2fs
------------[ cut here ]------------
kernel BUG at fs/f2fs/segment.c:1363!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 4 UID: 0 PID: 730 Comm: umount Not tainted 6.12.0-rc3+ #1107
RIP: 0010:__submit_discard_cmd+0xa53/0x1410
<TASK>
__issue_discard_cmd+0x3e5/0x1190
f2fs_issue_discard_timeout+0x244/0x360
f2fs_put_super+0x1fc/0xed0
generic_shutdown_super+0x14c/0x4a0
kill_block_super+0x40/0x90
kill_f2fs_super+0x264/0x430
Let me figure out a patch for that soon.:)
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
` (5 preceding siblings ...)
2024-11-21 9:50 ` bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-11-21 9:54 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-11-22 22:45 ` bugzilla-daemon--- via Linux-f2fs-devel
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-11-21 9:54 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
--- Comment #7 from Chao Yu (chao@kernel.org) ---
(In reply to piergiorgio.sartor from comment #3)
> One more thing, possibly important.
>
> When I create the snapshot, with the working kernel, while
> "max_discard_segments" is still "1", the other two, "discard_max_bytes" and
> "discard_max_hw_bytes" are both "0", instead of "2147450880".
Thanks for the hint, I think that would be a key to the truth.
Thanks,
>
> Hope this helps,
>
> bye,
>
> pg
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
` (6 preceding siblings ...)
2024-11-21 9:54 ` bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-11-22 22:45 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-12-12 18:57 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-12-17 13:39 ` bugzilla-daemon--- via Linux-f2fs-devel
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-11-22 22:45 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
--- Comment #8 from piergiorgio.sartor@nexgo.de ---
Thanks for taking the time to reproduce the issue.
I tried to compile the kernel with your patch, but it seems these days is not
anymore as easy as it used to be. No success...
Good the you manage to see the issue!
Thanks,
pg
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
` (7 preceding siblings ...)
2024-11-22 22:45 ` bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-12-12 18:57 ` bugzilla-daemon--- via Linux-f2fs-devel
2024-12-17 13:39 ` bugzilla-daemon--- via Linux-f2fs-devel
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-12-12 18:57 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
--- Comment #9 from piergiorgio.sartor@nexgo.de ---
Hi all,
I tested kernel-6.12.4-100.fc40.x86_64.rpm (Fedora 40, Koji build).
This is supposed to include the patch and, for what I tested, it seems to work
fine. No NULL pointer de-referencing, no crash, everything good as before.
I think you can close the bug, in case something else will pop up in the
future, I can re-open.
Thanks for the support!
Merry Christmas & Happy New Year!
bye,
pg
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread* [f2fs-dev] [Bug 219484] f2fs discard causes kernel NULL pointer dereferencing
2024-11-09 12:01 [f2fs-dev] [Bug 219484] New: f2fs discard causes kernel NULL pointer dereferencing bugzilla-daemon--- via Linux-f2fs-devel
` (8 preceding siblings ...)
2024-12-12 18:57 ` bugzilla-daemon--- via Linux-f2fs-devel
@ 2024-12-17 13:39 ` bugzilla-daemon--- via Linux-f2fs-devel
9 siblings, 0 replies; 11+ messages in thread
From: bugzilla-daemon--- via Linux-f2fs-devel @ 2024-12-17 13:39 UTC (permalink / raw)
To: linux-f2fs-devel
https://bugzilla.kernel.org/show_bug.cgi?id=219484
Chao Yu (chao@kernel.org) changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |CODE_FIX
--- Comment #10 from Chao Yu (chao@kernel.org) ---
(In reply to piergiorgio.sartor from comment #9)
> Hi all,
>
> I tested kernel-6.12.4-100.fc40.x86_64.rpm (Fedora 40, Koji build).
> This is supposed to include the patch and, for what I tested, it seems to
> work fine. No NULL pointer de-referencing, no crash, everything good as
> before.
Thank you very much for the test and feedback!
>
> I think you can close the bug, in case something else will pop up in the
> future, I can re-open.
Fine, let us know if you have any other problem.
>
> Thanks for the support!
>
> Merry Christmas & Happy New Year!
Merry Christmas & Happy New Year too!
Thanks,
>
> bye,
>
> pg
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread