Date: Tue, 6 Nov 2007 13:30:02 GMT From: Kostik Belousov <kostikbel@gmail.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/116539: [fdc] fdc(4) marks /dev/fd0 device busy when it should not, so does not allow to kldunload fdc.ko Message-ID: <200711061330.lA6DU2jv036665@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/116539; it has been noted by GNATS. From: Kostik Belousov <kostikbel@gmail.com> To: bug-followup@FreeBSD.org Cc: eugen@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711061330.lA6DU2jv036665>