Summary: | kernel panic using zfs on shsec | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | nvass | ||||||
Component: | kern | Assignee: | Mark Johnston <markj> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Some People | CC: | markj, nvass | ||||||
Priority: | --- | Keywords: | crash | ||||||
Version: | CURRENT | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
nvass
2021-04-16 19:55:51 UTC
Created attachment 231357 [details]
Disabling BIO_FLUSH fixes the panic
A quick fix in the attached patch is to disable BIO_FLUSH handling. A more proper fix would be to create a BIO_FLUSH handler.
This should be assigned to geom@ Created attachment 231358 [details]
proposed patch
The problem really appears to be that shsec erroneously allocates a buffer for BIO_FLUSH commands that get sent to child providers. It should only be doing this for reads and writes, so the attached patch is sufficient, I believe.
Hi Mark, Thank you for the analysis and the patch. I've tested it and it works fine. Please, commit it. It'd be nice to MFC too Thanks, Nikos A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=a2dfffb98917a57bfacb155b9d7d423c3e8ff792 commit a2dfffb98917a57bfacb155b9d7d423c3e8ff792 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-01-27 14:53:02 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-01-27 14:56:07 +0000 shsec: Allocate data blocks only for BIO_READ/WRITE requests In particular, there is no need to allocate a data block when passing BIO_FLUSH requests to child providers, and g_io_request() asserts that bp->bio_data == NULL for such requests. PR: 255131 Reported and tested by: nvass@gmx.com MFC after: 2 weeks Sponsored by: The FreeBSD Foundation sys/geom/shsec/g_shsec.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=14c0cde468e136a007a5a7e1bcb7b3a50a2a8b57 commit 14c0cde468e136a007a5a7e1bcb7b3a50a2a8b57 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-01-27 14:53:02 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-02-10 13:46:12 +0000 shsec: Allocate data blocks only for BIO_READ/WRITE requests In particular, there is no need to allocate a data block when passing BIO_FLUSH requests to child providers, and g_io_request() asserts that bp->bio_data == NULL for such requests. PR: 255131 Reported and tested by: nvass@gmx.com Sponsored by: The FreeBSD Foundation (cherry picked from commit a2dfffb98917a57bfacb155b9d7d423c3e8ff792) sys/geom/shsec/g_shsec.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) |