diff options
author | kib <kib@FreeBSD.org> | 2008-01-11 11:53:04 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2008-01-11 11:53:04 +0000 |
commit | ee6af6f46a9bcda3ea75104ea0688c3949dd2b35 (patch) | |
tree | 29d79169d7f769fa261c7e4b075c797cd0658e3d /sys/dev/fdc | |
parent | c7fe2c294acd6b2c41ab00906f9ec475a0e9d4dc (diff) | |
download | FreeBSD-src-ee6af6f46a9bcda3ea75104ea0688c3949dd2b35.zip FreeBSD-src-ee6af6f46a9bcda3ea75104ea0688c3949dd2b35.tar.gz |
Fix unload of the fdc.ko:
Wakeup the thread doing the fdc_detach() when the fdc worker thread exits [1].
Write access to the write-protected floppy shall call device_unbusy() to
pair the device_busy() in the fd_access() [2].
PR: 116537 [1], 116539 [2]
MFC after: 1 week
Diffstat (limited to 'sys/dev/fdc')
-rw-r--r-- | sys/dev/fdc/fdc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 50ba331..df1e629 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -1205,6 +1205,7 @@ fdc_thread(void *arg) mtx_lock(&fdc->fdc_mtx); } fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE); + wakeup(&fdc->fdc_thread); mtx_unlock(&fdc->fdc_mtx); kproc_exit(0); @@ -1383,6 +1384,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 +1405,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 +1418,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; |