Page MenuHomeFreeBSD

D54327.diff
No OneTemporary

D54327.diff

diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -545,6 +545,7 @@
bp->bio_from = cp;
bp->bio_to = pp;
bp->bio_error = 0;
+ bp->bio_error_compat = 0;
bp->bio_completed = 0;
KASSERT(!(bp->bio_flags & BIO_ONQUEUE),
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -4474,6 +4474,14 @@
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
* result in a deadlock in the filesystem or pager code. Note that
@@ -4505,8 +4513,19 @@
bp->bio_flags |= BIO_DONE;
wakeup(bp);
mtx_unlock(mtxp);
- } else
+ } else {
+ if ((bp->bio_flags & BIO_ERROR) != 0) {
+ /*
+ * Provide compatibility with the consumers of the old
+ * bio(9) KBI filled in bio_done callback handler.
+ */
+ bp->bio_error_compat = bp->bio_error;
+ bp->bio_flags |= BIO_ERROR_COMPAT;
+ }
done(bp);
+ bp->bio_error_compat = 0;
+ bp->bio_flags &= BIO_ERROR_COMPAT;
+ }
}
/*
diff --git a/sys/sys/bio.h b/sys/sys/bio.h
--- a/sys/sys/bio.h
+++ b/sys/sys/bio.h
@@ -54,7 +54,7 @@
#define BIO_SPEEDUP 0x0a /* Upper layers face shortage */
/* bio_flags */
-#define BIO_ERROR 0x01 /* An error occurred processing this bio. */
+#define BIO_ERROR_COMPAT 0x01 /* KBI compat on stable/15. */
#define BIO_DONE 0x02 /* This bio is finished. */
#define BIO_ONQUEUE 0x04 /* This bio is in a queue & not yet taken. */
/*
@@ -66,6 +66,7 @@
#define BIO_TRANSIENT_MAPPING 0x20
#define BIO_VLIST 0x40
#define BIO_SWAP 0x200 /* Swap-related I/O */
+#define BIO_ERROR 0x1000 /* An error occurred processing this bio. */
#define BIO_EXTERR 0x2000
#define BIO_SPEEDUP_WRITE 0x4000 /* Resource shortage at upper layers */
#define BIO_SPEEDUP_TRIM 0x8000 /* Resource shortage at upper layers */
@@ -97,6 +98,7 @@
struct vm_page **bio_ma; /* Or unmapped. */
int bio_ma_offset; /* Offset in the first page of bio_ma. */
int bio_ma_n; /* Number of pages in bio_ma. */
+ int bio_error_compat; /* Error for KBI compat on stable/15 */
long bio_resid; /* Remaining I/O in bytes. */
void (*bio_done)(struct bio *);
void *bio_driver1; /* Private use by the provider. */

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 1, 9:14 PM (1 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27444768
Default Alt Text
D54327.diff (2 KB)

Event Timeline