Pending NFS requests loop forever, blocking umount and not even allowing
for clean shutdown/reboot.

If you ever played with NFS for more than 30 seconds, you have run into
this and had to press the reset button, followed by suffering through
fsck...

Pending requests occur because the NFS server is gone (duh), network
problems (duh) or the server is sending replies faster than the client
can receive/reassemble packets (sneaky).

The least invasive fix is marking all pending requests "soft". Timeouts
apply and the blocking request gets discarded.

Index: nfs/nfs_vfsops.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.110
diff -u -p -r1.110 nfs_vfsops.c
--- nfs/nfs_vfsops.c    13 Aug 2016 20:53:17 -0000      1.110
+++ nfs/nfs_vfsops.c    10 Sep 2016 08:12:27 -0000
@@ -689,13 +689,18 @@ int
 nfs_unmount(struct mount *mp, int mntflags, struct proc *p)
 {
        struct nfsmount *nmp;
+       struct nfsreq *rep;
        int error, flags;
 
        nmp = VFSTONFS(mp);
        flags = 0;
 
-       if (mntflags & MNT_FORCE)
+       if (mntflags & MNT_FORCE) {
                flags |= FORCECLOSE;
+               TAILQ_FOREACH(rep, &nmp->nm_reqsq, r_chain) {
+                       rep->r_flags |= R_SOFTTERM;
+               }
+       }
 
        error = vflush(mp, NULL, flags);
        if (error)

Reply via email to