Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/nfs Serialize all access to the NFS request queue via sp...



details:   https://anonhg.NetBSD.org/src/rev/acd881fafcd1
branches:  trunk
changeset: 345957:acd881fafcd1
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jun 17 14:28:29 2016 +0000

description:
Serialize all access to the NFS request queue via splsoftnet(). Fixes random
crashes.
XXX: Pullup-7

diffstat:

 sys/nfs/nfs_clntsocket.c |  8 +++++---
 sys/nfs/nfs_socket.c     |  8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diffs (86 lines):

diff -r aff4f645235a -r acd881fafcd1 sys/nfs/nfs_clntsocket.c
--- a/sys/nfs/nfs_clntsocket.c  Fri Jun 17 07:41:56 2016 +0000
+++ b/sys/nfs/nfs_clntsocket.c  Fri Jun 17 14:28:29 2016 +0000
@@ -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 @@
        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 @@
                 * 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 @@
                        nmp->nm_timeouts = 0;
                        break;
                }
+               splx(s);
                nfs_rcvunlock(nmp);
                /*
                 * If not matched to a request, drop it.
diff -r aff4f645235a -r acd881fafcd1 sys/nfs/nfs_socket.c
--- a/sys/nfs/nfs_socket.c      Fri Jun 17 07:41:56 2016 +0000
+++ b/sys/nfs/nfs_socket.c      Fri Jun 17 14:28:29 2016 +0000
@@ -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 @@
 {
        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 @@
         * 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 @@
                        rp->r_rexmit = 0;
                }
        }
+       splx(s);
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index