kern/116539: [fdc] fdc(4) marks /dev/fd0 device busy when it
should not, so does not allow to kldunload fdc.ko
Kostik Belousov
kostikbel at gmail.com
Tue Nov 6 05:30:03 PST 2007
The following reply was made to PR kern/116539; it has been noted by GNATS.
From: Kostik Belousov <kostikbel at gmail.com>
To: bug-followup at FreeBSD.org
Cc: eugen at grosbein.pp.ru
Subject: Re: kern/116539: [fdc] fdc(4) marks /dev/fd0 device busy when it should not, so does not allow to kldunload fdc.ko
Date: Tue, 6 Nov 2007 15:25:58 +0200
device_busy() is counted. Try the following patch:
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index ea033a5..812823a 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -1383,6 +1383,7 @@ fd_access(struct g_provider *pp, int r, int w, int e)
struct fd_data *fd;
struct fdc_data *fdc;
int ar, aw, ae;
+ int busy;
fd = pp->geom->softc;
fdc = fd->fdc;
@@ -1403,6 +1404,7 @@ fd_access(struct g_provider *pp, int r, int w, int e)
return (0);
}
+ busy = 0;
if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) {
if (fdmisccmd(fd, BIO_PROBE, NULL))
return (ENXIO);
@@ -1415,10 +1417,14 @@ fd_access(struct g_provider *pp, int r, int w, int e)
mtx_unlock(&fdc->fdc_mtx);
}
device_busy(fd->dev);
+ busy = 1;
}
- if (w > 0 && (fd->flags & FD_WP))
+ if (w > 0 && (fd->flags & FD_WP)) {
+ if (busy)
+ device_unbusy(fd->dev);
return (EROFS);
+ }
pp->sectorsize = fd->sectorsize;
pp->stripesize = fd->ft->heads * fd->ft->sectrac * fd->sectorsize;
More information about the freebsd-bugs
mailing list