Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_bio.c
| Show First 20 Lines • Show All 4,468 Lines • ▼ Show 20 Lines | ||||||||||
| biodone(struct bio *bp) | biodone(struct bio *bp) | |||||||||
| { | { | |||||||||
| struct mtx *mtxp; | struct mtx *mtxp; | |||||||||
| void (*done)(struct bio *); | void (*done)(struct bio *); | |||||||||
| vm_offset_t start, end; | vm_offset_t start, end; | |||||||||
| biotrack(bp, __func__); | biotrack(bp, __func__); | |||||||||
| if ((bp->bio_flags & BIO_ERROR_COMPAT) != 0) { | ||||||||||
| /* The caller of this KPI is using the old bio(9) KBI */ | ||||||||||
| bp->bio_error = bp->bio_error_compat; | ||||||||||
| bp->bio_flags |= BIO_ERROR; | ||||||||||
| bp->bio_error_compat = 0; | ||||||||||
| bp->bio_flags &= BIO_ERROR_COMPAT; | ||||||||||
| } | ||||||||||
| /* | /* | |||||||||
| * Avoid completing I/O when dumping after a panic since that may | * Avoid completing I/O when dumping after a panic since that may | |||||||||
| * result in a deadlock in the filesystem or pager code. Note that | * result in a deadlock in the filesystem or pager code. Note that | |||||||||
kib: Why keep both bio_error and bio_error_compat filled? IMO the errors flow 'up', we must… | ||||||||||
Done Inline Actions
The new revision no longer keeps both filled all the time.
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(). khng: > After we pass biodone, the kernel is already using bio_error and not compat.
The new revision… | ||||||||||
| * this doesn't affect dumps that were started manually since we aim | * this doesn't affect dumps that were started manually since we aim | |||||||||
| * to keep the system usable after it has been resumed. | * to keep the system usable after it has been resumed. | |||||||||
| */ | */ | |||||||||
| if (__predict_false(dumping && SCHEDULER_STOPPED())) { | if (__predict_false(dumping && SCHEDULER_STOPPED())) { | |||||||||
| TAILQ_INSERT_HEAD(&nondump_bios, bp, bio_queue); | TAILQ_INSERT_HEAD(&nondump_bios, bp, bio_queue); | |||||||||
| return; | return; | |||||||||
| } | } | |||||||||
| if ((bp->bio_flags & BIO_TRANSIENT_MAPPING) != 0) { | if ((bp->bio_flags & BIO_TRANSIENT_MAPPING) != 0) { | |||||||||
| Show All 12 Lines | biodone(struct bio *bp) | |||||||||
| * used as a bio_done routine. | * used as a bio_done routine. | |||||||||
| */ | */ | |||||||||
| if (done == NULL || done == biodone) { | if (done == NULL || done == biodone) { | |||||||||
| mtxp = mtx_pool_find(mtxpool_sleep, bp); | mtxp = mtx_pool_find(mtxpool_sleep, bp); | |||||||||
| mtx_lock(mtxp); | mtx_lock(mtxp); | |||||||||
| bp->bio_flags |= BIO_DONE; | bp->bio_flags |= BIO_DONE; | |||||||||
| wakeup(bp); | wakeup(bp); | |||||||||
| mtx_unlock(mtxp); | mtx_unlock(mtxp); | |||||||||
| } else | } else { | |||||||||
| if ((bp->bio_flags & BIO_ERROR) != 0) { | ||||||||||
| /* | ||||||||||
Done Inline Actions
Multi-line comment should be in style(9) kib: Multi-line comment should be in style(9) | ||||||||||
| * Provide compatibility with the consumers of the old | ||||||||||
| * bio(9) KBI filled in bio_done callback handler. | ||||||||||
Not Done Inline Actions
kib: | ||||||||||
Done Inline ActionsYep. khng: Yep. | ||||||||||
| */ | ||||||||||
| bp->bio_error_compat = bp->bio_error; | ||||||||||
| bp->bio_flags |= BIO_ERROR_COMPAT; | ||||||||||
| } | ||||||||||
| done(bp); | done(bp); | |||||||||
| bp->bio_error_compat = 0; | ||||||||||
| bp->bio_flags &= BIO_ERROR_COMPAT; | ||||||||||
| } | ||||||||||
| } | } | |||||||||
| /* | /* | |||||||||
| * Wait for a BIO to finish. | * Wait for a BIO to finish. | |||||||||
| */ | */ | |||||||||
| int | int | |||||||||
| biowait(struct bio *bp, const char *wmesg) | biowait(struct bio *bp, const char *wmesg) | |||||||||
| { | { | |||||||||
| ▲ Show 20 Lines • Show All 1,158 Lines • Show Last 20 Lines | ||||||||||
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.