summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_dev.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-01-14 21:31:00 +0000
committerphk <phk@FreeBSD.org>2003-01-14 21:31:00 +0000
commitaaa813638739380df4bbfde2082a0191303b35e2 (patch)
tree148f0031741511b56db30ea292d5978a76543c2a /sys/geom/geom_dev.c
parente0f2b06d78b09ba9a17dd03a816a484c8f8f7112 (diff)
downloadFreeBSD-src-aaa813638739380df4bbfde2082a0191303b35e2.zip
FreeBSD-src-aaa813638739380df4bbfde2082a0191303b35e2.tar.gz
Now that we have non-geom_disk based drivers, we need to cover for those,
in case they return EOPNOTSUPP on an ioctl. Found by: jhb
Diffstat (limited to 'sys/geom/geom_dev.c')
-rw-r--r--sys/geom/geom_dev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index 188fc29..fd2b44d 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -260,6 +260,7 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
error = 0;
DROP_GIANT();
+ gio = NULL;
i = IOCPARM_LEN(cmd);
switch (cmd) {
case DIOCGSECTORSIZE:
@@ -322,10 +323,8 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
KASSERT(gio->func != NULL, ("NULL function but EDIRIOCTL"));
error = (gio->func)(gio->dev, cmd, data, fflag, td);
}
- if (gio != NULL)
- g_free(gio);
g_waitidle();
- if (error == ENOIOCTL) {
+ if (gio != NULL && (error == EOPNOTSUPP || error == ENOIOCTL)) {
if (g_debugflags & G_T_TOPOLOGY) {
i = IOCGROUP(cmd);
printf("IOCTL(0x%lx) \"%s\"", cmd, gp->name);
@@ -342,6 +341,8 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
}
error = ENOTTY;
}
+ if (gio != NULL)
+ g_free(gio);
return (error);
}
OpenPOWER on IntegriCloud