Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jun 2016 18:29:43 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302019 - head/sys/fs/nfsclient
Message-ID:  <201606191829.u5JIThWV007424@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Jun 19 18:29:43 2016
New Revision: 302019
URL: https://svnweb.freebsd.org/changeset/base/302019

Log:
  Do not access NFS data for reclaimed vnode.
  
  Reported and tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Approved by:	re (delphij)

Modified:
  head/sys/fs/nfsclient/nfs_clvnops.c

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c	Sun Jun 19 07:31:02 2016	(r302018)
+++ head/sys/fs/nfsclient/nfs_clvnops.c	Sun Jun 19 18:29:43 2016	(r302019)
@@ -3097,10 +3097,14 @@ nfs_advlock(struct vop_advlock_args *ap)
 			}
 		}
 		if (error == 0 && ap->a_op == F_SETLK) {
-			/* Mark that a file lock has been acquired. */
-			mtx_lock(&np->n_mtx);
-			np->n_flag |= NHASBEENLOCKED;
-			mtx_unlock(&np->n_mtx);
+			error = NFSVOPLOCK(vp, LK_SHARED);
+			if (error == 0) {
+				/* Mark that a file lock has been acquired. */
+				mtx_lock(&np->n_mtx);
+				np->n_flag |= NHASBEENLOCKED;
+				mtx_unlock(&np->n_mtx);
+				NFSVOPUNLOCK(vp, 0);
+			}
 		}
 	}
 	return (error);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606191829.u5JIThWV007424>