Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs This is a temporary hack to avoid nfs crashes relate...



details:   https://anonhg.NetBSD.org/src/rev/90e7e55ec5ca
branches:  trunk
changeset: 359616:90e7e55ec5ca
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 14 19:19:34 2022 +0000

description:
This is a temporary hack to avoid nfs crashes related to nfs_delaytruncate.

diffstat:

 sys/nfs/nfs_clntsubs.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 16e8908ae38e -r 90e7e55ec5ca sys/nfs/nfs_clntsubs.c
--- a/sys/nfs/nfs_clntsubs.c    Fri Jan 14 18:43:23 2022 +0000
+++ b/sys/nfs/nfs_clntsubs.c    Fri Jan 14 19:19:34 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_clntsubs.c,v 1.4 2020/02/23 15:46:41 ad Exp $      */
+/*     $NetBSD: nfs_clntsubs.c,v 1.5 2022/01/14 19:19:34 christos Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_clntsubs.c,v 1.4 2020/02/23 15:46:41 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_clntsubs.c,v 1.5 2022/01/14 19:19:34 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -360,9 +360,20 @@
                np->n_flag &= ~NTRUNCDELAYED;
                genfs_node_wrlock(vp);
                rw_enter(vp->v_uobj.vmobjlock, RW_WRITER);
+
+               /*
+                * This is disgusting but we can be called from VOP_UNLOCK
+                * where the interlock is sometimes held, and we want to
+                * make sure that it is unlocked when we call VOP_PUTPAGES
+                * and uvm_vnp_setsize.
+                */
+               int got = mutex_tryenter(vp->v_interlock);
+               mutex_exit(vp->v_interlock);
                (void)VOP_PUTPAGES(vp, 0,
                    0, PGO_SYNCIO | PGO_CLEANIT | PGO_FREE | PGO_ALLPAGES);
                uvm_vnp_setsize(vp, np->n_size);
+               if (!got)
+                       mutex_enter(vp->v_interlock);
                genfs_node_unlock(vp);
        }
 }



Home | Main Index | Thread Index | Old Index