Module Name: src
Committed By: christos
Date: Fri Jun 17 14:28:29 UTC 2016
Modified Files:
src/sys/nfs: nfs_clntsocket.c nfs_socket.c
Log Message:
Serialize all access to the NFS request queue via splsoftnet(). Fixes random
crashes.
XXX: Pullup-7
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/nfs/nfs_clntsocket.c
cvs rdiff -u -r1.197 -r1.198 src/sys/nfs/nfs_socket.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/nfs/nfs_clntsocket.c
diff -u src/sys/nfs/nfs_clntsocket.c:1.4 src/sys/nfs/nfs_clntsocket.c:1.5
--- src/sys/nfs/nfs_clntsocket.c:1.4 Mon Jun 13 10:23:26 2016
+++ src/sys/nfs/nfs_clntsocket.c Fri Jun 17 10:28:29 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_clntsocket.c,v 1.4 2016/06/13 14:23:26 christos Exp $ */
+/* $NetBSD: nfs_clntsocket.c,v 1.5 2016/06/17 14:28:29 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_clntsocket.c,v 1.4 2016/06/13 14:23:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_clntsocket.c,v 1.5 2016/06/17 14:28:29 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_nfs.h"
@@ -324,7 +324,7 @@ nfs_reply(struct nfsreq *myrep, struct l
struct mbuf *mrep, *nam, *md;
u_int32_t rxid, *tl;
char *dpos, *cp2;
- int error;
+ int error, s;
/*
* Loop around until we get our own reply
@@ -402,6 +402,7 @@ nfsmout:
* Loop through the request list to match up the reply
* Iff no match, just drop the datagram
*/
+ s = splsoftnet();
TAILQ_FOREACH(rep, &nfs_reqq, r_chain) {
if (rep->r_mrep != NULL || rxid != rep->r_xid)
continue;
@@ -467,6 +468,7 @@ nfsmout:
nmp->nm_timeouts = 0;
break;
}
+ splx(s);
nfs_rcvunlock(nmp);
/*
* If not matched to a request, drop it.
Index: src/sys/nfs/nfs_socket.c
diff -u src/sys/nfs/nfs_socket.c:1.197 src/sys/nfs/nfs_socket.c:1.198
--- src/sys/nfs/nfs_socket.c:1.197 Tue Jul 14 23:28:55 2015
+++ src/sys/nfs/nfs_socket.c Fri Jun 17 10:28:29 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_socket.c,v 1.197 2015/07/15 03:28:55 manu Exp $ */
+/* $NetBSD: nfs_socket.c,v 1.198 2016/06/17 14:28:29 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.197 2015/07/15 03:28:55 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.198 2016/06/17 14:28:29 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_nfs.h"
@@ -349,7 +349,7 @@ nfs_reconnect(struct nfsreq *rep)
{
struct nfsreq *rp;
struct nfsmount *nmp = rep->r_nmp;
- int error;
+ int error, s;
time_t before_ts;
nfs_disconnect(nmp);
@@ -384,6 +384,7 @@ nfs_reconnect(struct nfsreq *rep)
* Loop through outstanding request list and fix up all requests
* on old socket.
*/
+ s = splsoftnet();
TAILQ_FOREACH(rp, &nfs_reqq, r_chain) {
if (rp->r_nmp == nmp) {
if ((rp->r_flags & R_MUSTRESEND) == 0)
@@ -391,6 +392,7 @@ nfs_reconnect(struct nfsreq *rep)
rp->r_rexmit = 0;
}
}
+ splx(s);
return (0);
}