Source-Changes-D archive

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

Re: CVS commit: src/sys/kern



> On 12. Jan 2020, at 18:49, Andrew Doran <ad%netbsd.org@localhost> wrote:
> 
> Module Name:	src
> Committed By:	ad
> Date:		Sun Jan 12 17:49:17 UTC 2020
> 
> Modified Files:
> 	src/sys/kern: vfs_vnode.c
> 
> Log Message:
> vput(): don't drop the vnode lock, carry the hold over into vrelel() which
> might need it anyway.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.106 -r1.107 src/sys/kern/vfs_vnode.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 

 vput(vnode_t *vp)
 {
+       int lktype;

-       VOP_UNLOCK(vp);
-       vrele(vp);
+       if ((vp->v_vflag & VV_LOCKSWORK) == 0) {
+               lktype = LK_EXCLUSIVE;
+       } else {
+               lktype = VOP_ISLOCKED(vp);
+               KASSERT(lktype != LK_NONE);
+       }
+       mutex_enter(vp->v_interlock);
+       vrelel(vp, 0, lktype);
 }

This is quite wrong, from the manual:

     VOP_ISLOCKED(vp)
              Test if the vnode vp is locked.  Possible return values are
              LK_EXCLUSIVE, LK_SHARED or 0 for lock held exclusively by the
              calling thread, shared lock held by anyone or unlocked,
              respectively.

              This function must never be used to make locking decisions at
              run time: it is provided only for diagnostic purposes.

I suppose you cannot determine if the current thread holds
a shared lock.

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig

Attachment: signature.asc
Description: Message signed with OpenPGP



Home | Main Index | Thread Index | Old Index