Fix various bugs in the locking protocol, allowing proper shared locks
to be used. This should fix the lock panics that people are seeing.
This commit is contained in:
parent
42146e3747
commit
4ba14e3a10
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24626
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id$
|
||||
* $Id: nfs_subs.c,v 1.37 1997/02/22 09:42:41 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1280,14 +1280,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
*/
|
||||
np = VTONFS(vp);
|
||||
if (vp->v_type != vtyp) {
|
||||
/*
|
||||
* If we had a lock and it turns out that the vnode
|
||||
* is an object which we don't want to lock (e.g. VDIR)
|
||||
* to avoid nasty hanging problems on a server crash,
|
||||
* then release it here.
|
||||
*/
|
||||
if (vtyp != VREG && VOP_ISLOCKED(vp))
|
||||
VOP_UNLOCK(vp, 0, p);
|
||||
vp->v_type = vtyp;
|
||||
if (vp->v_type == VFIFO) {
|
||||
vp->v_op = fifo_nfsv2nodeop_p;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id$
|
||||
* $Id: nfs_subs.c,v 1.37 1997/02/22 09:42:41 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1280,14 +1280,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
*/
|
||||
np = VTONFS(vp);
|
||||
if (vp->v_type != vtyp) {
|
||||
/*
|
||||
* If we had a lock and it turns out that the vnode
|
||||
* is an object which we don't want to lock (e.g. VDIR)
|
||||
* to avoid nasty hanging problems on a server crash,
|
||||
* then release it here.
|
||||
*/
|
||||
if (vtyp != VREG && VOP_ISLOCKED(vp))
|
||||
VOP_UNLOCK(vp, 0, p);
|
||||
vp->v_type = vtyp;
|
||||
if (vp->v_type == VFIFO) {
|
||||
vp->v_op = fifo_nfsv2nodeop_p;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
|
||||
* $Id: nfs_vfsops.c,v 1.35 1997/02/22 09:42:44 peter Exp $
|
||||
* $Id: nfs_vfsops.c,v 1.36 1997/03/24 11:33:39 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -904,7 +904,6 @@ nfs_root(mp, vpp)
|
||||
if (error)
|
||||
return (error);
|
||||
vp = NFSTOV(np);
|
||||
VOP_UNLOCK(vp, 0, curproc);
|
||||
if (vp->v_type == VNON)
|
||||
vp->v_type = VDIR;
|
||||
vp->v_flag = VROOT;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
|
||||
* $Id: nfs_vnops.c,v 1.44 1997/03/22 06:53:12 bde Exp $
|
||||
* $Id: nfs_vnops.c,v 1.45 1997/03/29 12:40:20 bde Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -1603,7 +1603,7 @@ nfs_rename(ap)
|
||||
*/
|
||||
if (tvp && tvp->v_usecount > 1 && !VTONFS(tvp)->n_sillyrename &&
|
||||
tvp->v_type != VDIR && !nfs_sillyrename(tdvp, tvp, tcnp)) {
|
||||
vrele(tvp);
|
||||
vput(tvp);
|
||||
tvp = NULL;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfsnode.h 8.9 (Berkeley) 5/14/95
|
||||
* $Id$
|
||||
* $Id: nfsnode.h,v 1.19 1997/02/22 09:42:49 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ int nqnfs_vop_lease_check __P((struct vop_lease_args *));
|
||||
int nfs_abortop __P((struct vop_abortop_args *));
|
||||
int nfs_inactive __P((struct vop_inactive_args *));
|
||||
int nfs_reclaim __P((struct vop_reclaim_args *));
|
||||
#define nfs_lock ((int (*) __P((struct vop_lock_args *)))vop_nolock)
|
||||
#define nfs_lock ((int (*) __P((struct vop_lock_args *)))vop_sharedlock)
|
||||
#define nfs_unlock ((int (*) __P((struct vop_unlock_args *)))vop_nounlock)
|
||||
#define nfs_islocked ((int (*) __P((struct vop_islocked_args *)))vop_noislocked)
|
||||
#define nfs_reallocblks \
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id$
|
||||
* $Id: nfs_subs.c,v 1.37 1997/02/22 09:42:41 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1280,14 +1280,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
*/
|
||||
np = VTONFS(vp);
|
||||
if (vp->v_type != vtyp) {
|
||||
/*
|
||||
* If we had a lock and it turns out that the vnode
|
||||
* is an object which we don't want to lock (e.g. VDIR)
|
||||
* to avoid nasty hanging problems on a server crash,
|
||||
* then release it here.
|
||||
*/
|
||||
if (vtyp != VREG && VOP_ISLOCKED(vp))
|
||||
VOP_UNLOCK(vp, 0, p);
|
||||
vp->v_type = vtyp;
|
||||
if (vp->v_type == VFIFO) {
|
||||
vp->v_op = fifo_nfsv2nodeop_p;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
|
||||
* $Id: nfs_vfsops.c,v 1.35 1997/02/22 09:42:44 peter Exp $
|
||||
* $Id: nfs_vfsops.c,v 1.36 1997/03/24 11:33:39 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -904,7 +904,6 @@ nfs_root(mp, vpp)
|
||||
if (error)
|
||||
return (error);
|
||||
vp = NFSTOV(np);
|
||||
VOP_UNLOCK(vp, 0, curproc);
|
||||
if (vp->v_type == VNON)
|
||||
vp->v_type = VDIR;
|
||||
vp->v_flag = VROOT;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
|
||||
* $Id: nfs_vnops.c,v 1.44 1997/03/22 06:53:12 bde Exp $
|
||||
* $Id: nfs_vnops.c,v 1.45 1997/03/29 12:40:20 bde Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -1603,7 +1603,7 @@ nfs_rename(ap)
|
||||
*/
|
||||
if (tvp && tvp->v_usecount > 1 && !VTONFS(tvp)->n_sillyrename &&
|
||||
tvp->v_type != VDIR && !nfs_sillyrename(tdvp, tvp, tcnp)) {
|
||||
vrele(tvp);
|
||||
vput(tvp);
|
||||
tvp = NULL;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfsnode.h 8.9 (Berkeley) 5/14/95
|
||||
* $Id$
|
||||
* $Id: nfsnode.h,v 1.19 1997/02/22 09:42:49 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ int nqnfs_vop_lease_check __P((struct vop_lease_args *));
|
||||
int nfs_abortop __P((struct vop_abortop_args *));
|
||||
int nfs_inactive __P((struct vop_inactive_args *));
|
||||
int nfs_reclaim __P((struct vop_reclaim_args *));
|
||||
#define nfs_lock ((int (*) __P((struct vop_lock_args *)))vop_nolock)
|
||||
#define nfs_lock ((int (*) __P((struct vop_lock_args *)))vop_sharedlock)
|
||||
#define nfs_unlock ((int (*) __P((struct vop_unlock_args *)))vop_nounlock)
|
||||
#define nfs_islocked ((int (*) __P((struct vop_islocked_args *)))vop_noislocked)
|
||||
#define nfs_reallocblks \
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id$
|
||||
* $Id: nfs_subs.c,v 1.37 1997/02/22 09:42:41 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1280,14 +1280,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
*/
|
||||
np = VTONFS(vp);
|
||||
if (vp->v_type != vtyp) {
|
||||
/*
|
||||
* If we had a lock and it turns out that the vnode
|
||||
* is an object which we don't want to lock (e.g. VDIR)
|
||||
* to avoid nasty hanging problems on a server crash,
|
||||
* then release it here.
|
||||
*/
|
||||
if (vtyp != VREG && VOP_ISLOCKED(vp))
|
||||
VOP_UNLOCK(vp, 0, p);
|
||||
vp->v_type = vtyp;
|
||||
if (vp->v_type == VFIFO) {
|
||||
vp->v_op = fifo_nfsv2nodeop_p;
|
||||
|
Loading…
Reference in New Issue
Block a user