aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fdc/fdc.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2008-01-11 11:53:04 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2008-01-11 11:53:04 +0000
commitfc9f8bcf4f25461d922731c3e114fbc76b45600e (patch)
tree29d79169d7f769fa261c7e4b075c797cd0658e3d /sys/dev/fdc/fdc.c
parent73b2958b9422da744c9e7ae6291874c03a2b4325 (diff)
downloadsrc-fc9f8bcf4f25461d922731c3e114fbc76b45600e.tar.gz
src-fc9f8bcf4f25461d922731c3e114fbc76b45600e.zip
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
Notes
Notes: svn path=/head/; revision=175226
Diffstat (limited to 'sys/dev/fdc/fdc.c')
-rw-r--r--sys/dev/fdc/fdc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 50ba331602e7..df1e629f27af 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;