Subject: Re: nfsd: locking botch in op %d
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 03/08/2001 12:40:04
> How p->p_locks could be 1 for the server process when the only locked
> vnode is locked by a completely unrelated process is a mystery to me.
> Perhaps it's holding something other than a vnode locked?

I've just spent a few minutes reading over kern_lock.c, lockmgr() in
particular (because that's the only place p_locks is changed).

It looks vaguely schizoid about what p_locks is suppsoed to count.
Reading the code gives me the impression it's a count of all locks,
shared and exclusive both, with recursive locks counted multiple times.

And in that case, I think the code for using LK_SHARED to downgrade an
exclusive lock is wrong; it does COUNT(,,,1) even though the total lock
count is not changing.  It looks to me as though both the COUNT and the
sharecount++ before it should go.  Am I just confused?

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B