From 2f532a77b77cfd82219275864929f27b49ad0daa Mon Sep 17 00:00:00 2001 From: pjd Date: Tue, 25 Oct 2011 14:07:17 +0000 Subject: [PATCH] Allow upper layers to discover than BIO_DELETE and/or BIO_FLUSH is not supported by returning EOPNOTSUPP instead of 0 or ENODEV. MFC after: 3 days --- sys/geom/geom_disk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index fd5955de5ff2..6b6c5ae83bde 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -305,7 +305,7 @@ g_disk_start(struct bio *bp) switch(bp->bio_cmd) { case BIO_DELETE: if (!(dp->d_flags & DISKFLAG_CANDELETE)) { - error = 0; + error = EOPNOTSUPP; break; } /* fall-through */ @@ -394,8 +394,8 @@ g_disk_start(struct bio *bp) g_trace(G_T_TOPOLOGY, "g_disk_flushcache(%s)", bp->bio_to->name); if (!(dp->d_flags & DISKFLAG_CANFLUSHCACHE)) { - g_io_deliver(bp, ENODEV); - return; + error = EOPNOTSUPP; + break; } bp2 = g_clone_bio(bp); if (bp2 == NULL) {