Page MenuHomeFreeBSD

geom(9): struct bio KBI fix
ClosedPublic

Authored by khng on Sat, Dec 20, 7:56 PM.
Tags
None
Referenced Files
F140485914: D54327.id168476.diff
Wed, Dec 24, 12:45 PM
Unknown Object (File)
Tue, Dec 23, 9:29 PM
Unknown Object (File)
Tue, Dec 23, 2:13 AM
Unknown Object (File)
Mon, Dec 22, 9:48 PM
Unknown Object (File)
Sun, Dec 21, 10:37 AM
Unknown Object (File)
Sun, Dec 21, 8:31 AM
Unknown Object (File)
Sun, Dec 21, 6:17 AM
Unknown Object (File)
Sun, Dec 21, 5:37 AM
Subscribers

Details

Summary

The struct bio was changed after cb85c2e2e995 on the branch. To fix
this, move BIO_ERROR flag to another value, and now BIO_ERROR_COMPAT
occupies 0x1 instead. Also, introduce b_error_compat field at the place
where the old bio_error was.

This allows non-CAM(9) disk drivers and software volume manager modules
compiled against 15.0-RELEASE kernel to work on 15-STABLE kernel again.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69415
Build 66298: arc lint + arc unit

Event Timeline

khng requested review of this revision.Sat, Dec 20, 7:56 PM
khng planned changes to this revision.Sat, Dec 20, 8:03 PM

g_io_request will empty bio_error_compat as well.

So a few words about why this is useful. Our KBI commitments on 15.x is fuzzy at best. What does this enable?

In D54327#1241511, @imp wrote:

So a few words about why this is useful. Our KBI commitments on 15.x is fuzzy at best. What does this enable?

Non-cam(9) drivers or software volume manager implementations not maintained in the FreeBSD-src tree would benefit from that. Should that goes into the commit comment as well?

sys/kern/vfs_bio.c
4488

Why keep both bio_error and bio_error_compat filled? IMO the errors flow 'up', we must translate from compat to proper error, and then clear compat error place and flag. After we pass biodone, the kernel is already using bio_error and not compat.

Also, there are several more places which propagate errors from the subordinate bio to the parent. I think all of them should be converted similarly, see the original commit to easily identify the source locations.

khng edited the summary of this revision. (Show Details)

Within biodone(9):

  • Translate bio_error_compat to bio_error, then clear the bio_error_compat and BIO_ERROR_COMPAT flag.
  • Beforef calling bp->bio_done(), set the bio_error_compat field and BIO_ERROR_COMPAT flag if BIO_ERROR is set. Clear bio_error_compat and the BIO_ERROR_COMPAT flag after returning from bp->bio_done().
sys/kern/vfs_bio.c
4488

After we pass biodone, the kernel is already using bio_error and not compat.

The new revision no longer keeps both filled all the time.

Also, there are several more places which propagate errors from the subordinate bio to the parent. I think all of them should be converted similarly, see the original commit to easily identify the source locations.

This shall also be covered by biodone() alone: When propagating to the parent, they all at the end delivers the error either by calling g_io_deliver(), or setting bp->bio_error then calling biodone().

sys/kern/vfs_bio.c
4523

Multi-line comment should be in style(9)

khng marked an inline comment as done.

Fix multi-line comments and wordings.

I suppose this is for stable/15, right?

sys/kern/vfs_bio.c
4525
This revision is now accepted and ready to land.Sun, Dec 21, 10:26 PM
sys/kern/vfs_bio.c
4525

Yep.

In D54327#1241761, @kib wrote:

I suppose this is for stable/15, right?

Yep. This change is only for stable/15.

This revision was automatically updated to reflect the committed changes.