aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2013-04-18 23:20:16 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2013-04-18 23:20:16 +0000
commit64a0e848abbc491831a2969e72ecfb6a0ae9716c (patch)
tree123e23f31a2970af6a69b52f37d7e4e48743083c /sys/nfsclient
parent3cc7ae06fd8c2cac6eb5051a5e48ab00d17adc1b (diff)
Notes
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_nfsiod.c8
-rw-r--r--sys/nfsclient/nfs_vfsops.c10
2 files changed, 17 insertions, 1 deletions
diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c
index d34c205a48e5..2fb2c88151ac 100644
--- a/sys/nfsclient/nfs_nfsiod.c
+++ b/sys/nfsclient/nfs_nfsiod.c
@@ -308,6 +308,14 @@ nfssvc_iod(void *instance)
mtx_unlock(&Giant);
mtx_lock(&nfs_iod_mtx);
/*
+ * Make sure the nmp hasn't been dismounted as soon as
+ * nfs_doio() completes for the last buffer.
+ */
+ nmp = nfs_iodmount[myiod];
+ if (nmp == NULL)
+ break;
+
+ /*
* If there are more than one iod on this mount, then defect
* so that the iods can be shared out fairly between the mounts
*/
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index 6f00cf90de2f..7a26aa20aff1 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -1362,7 +1362,7 @@ static int
nfs_unmount(struct mount *mp, int mntflags)
{
struct nfsmount *nmp;
- int error, flags = 0;
+ int error, flags = 0, i;
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
@@ -1387,6 +1387,14 @@ nfs_unmount(struct mount *mp, int mntflags)
/*
* We are now committed to the unmount.
*/
+ /* Make sure no nfsiods are assigned to this mount. */
+ mtx_lock(&nfs_iod_mtx);
+ for (i = 0; i < NFS_MAXASYNCDAEMON; i++)
+ if (nfs_iodmount[i] == nmp) {
+ nfs_iodwant[i] = NFSIOD_AVAILABLE;
+ nfs_iodmount[i] = NULL;
+ }
+ mtx_unlock(&nfs_iod_mtx);
nfs_disconnect(nmp);
free(nmp->nm_nam, M_SONAME);