aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/geom/geom_dev.c13
-rw-r--r--sys/geom/geom_io.c6
2 files changed, 6 insertions, 13 deletions
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index 9c33ab71e6c8..24ab14e90c1b 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -634,19 +634,6 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread
error = EINVAL;
break;
}
- if ((pp->mediasize > 0) && (offset >= pp->mediasize)) {
- /*
- * Catch out-of-bounds requests here. The problem is
- * that due to historical GEOM I/O implementation
- * peculatities, g_delete_data() would always return
- * success for requests starting just the next byte
- * after providers media boundary. Condition check on
- * non-zero media size, since that condition would
- * (most likely) cause ENXIO instead.
- */
- error = EIO;
- break;
- }
while (length > 0) {
chunk = length;
if (g_dev_del_max_sectors != 0 &&
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index 4134645fe618..9bdcd12bf240 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -886,6 +886,8 @@ g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error)
bp->bio_data = ptr;
g_io_request(bp, cp);
errorc = biowait(bp, "gread");
+ if (errorc == 0 && bp->bio_completed != length)
+ errorc = EIO;
if (error != NULL)
*error = errorc;
g_destroy_bio(bp);
@@ -940,6 +942,8 @@ g_write_data(struct g_consumer *cp, off_t offset, void *ptr, off_t length)
bp->bio_data = ptr;
g_io_request(bp, cp);
error = biowait(bp, "gwrite");
+ if (error == 0 && bp->bio_completed != length)
+ error = EIO;
g_destroy_bio(bp);
return (error);
}
@@ -971,6 +975,8 @@ g_delete_data(struct g_consumer *cp, off_t offset, off_t length)
bp->bio_data = NULL;
g_io_request(bp, cp);
error = biowait(bp, "gdelete");
+ if (error == 0 && bp->bio_completed != length)
+ error = EIO;
g_destroy_bio(bp);
return (error);
}