From aaa813638739380df4bbfde2082a0191303b35e2 Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 14 Jan 2003 21:31:00 +0000 Subject: 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 --- sys/geom/geom_dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/geom/geom_dev.c') 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); } -- cgit v1.1