summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_nfsiod.c
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2013-04-18 23:20:16 +0000
committerrmacklem <rmacklem@FreeBSD.org>2013-04-18 23:20:16 +0000
commit1110825468efffa72f05077e3a42f5e5fa6963ec (patch)
tree123e23f31a2970af6a69b52f37d7e4e48743083c /sys/nfsclient/nfs_nfsiod.c
parentdbe08652086db71f7da0c7cd173a0902f345998d (diff)
downloadFreeBSD-src-1110825468efffa72f05077e3a42f5e5fa6963ec.zip
FreeBSD-src-1110825468efffa72f05077e3a42f5e5fa6963ec.tar.gz
When an NFS unmount occurs, once vflush() writes the last dirty
buffer for the last vnode on the mount back to the server, it returns. At that point, the code continues with the unmount, including freeing up the nfs specific part of the mount structure. It is possible that an nfsiod thread will try to check for an empty I/O queue in the nfs specific part of the mount structure after it has been free'd by the unmount. This patch avoids this problem by setting the iodmount entries for the mount back to NULL while holding the mutex in the unmount and checking the appropriate entry is non-NULL after acquiring the mutex in the nfsiod thread. Reported and tested by: pho Reviewed by: kib MFC after: 2 weeks
Diffstat (limited to 'sys/nfsclient/nfs_nfsiod.c')
-rw-r--r--sys/nfsclient/nfs_nfsiod.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c
index d34c205..2fb2c88 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
*/
OpenPOWER on IntegriCloud