Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 May 1997 11:54:24 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        phk@dk.tfs.com (Poul-Henning Kamp)
Cc:        dfr@nlsystems.com, phk@dk.tfs.com, current@FreeBSD.ORG
Subject:   Re: vnode->v_usage
Message-ID:  <199705021854.LAA09219@phaeton.artisoft.com>
In-Reply-To: <5321.862569821@critter> from "Poul-Henning Kamp" at May 2, 97 12:43:41 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Ok, now I'm in doubt here...  Which of these two places are the
> correct place to release the interlock, I've marked the candidates
> with XXX, I pressume the later, right ?
> 
> 	void
> 	vtouch(vp)
> 		struct vnode *vp;
> 	{
> 		simple_lock(&vp->v_interlock);
> 		if (vp->v_usecount) {
> 			simple_unlock(&vp->v_interlock);
> 			return;
> 		}
> 		simple_unlock(&vp->v_interlock);  /* XXX */
> 		simple_lock(&vnode_free_list_slock);
> 		TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
> 		TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
> 		simple_unlock(&vnode_free_list_slock);
> 		simple_unlock(&vp->v_interlock);  /* XXX */
> 	}

The first place may allow the code to be reentered.

The second place may deadly-embrace deadlock during directory lookups
for open or elsewhere, though I can't tell you for sure.


Could you artifically bump the use count over the operation?  Hold
the interlock, bump the count, release the interlock, move the
vnode, hold the interlock, decrement the use count, release the
interlock?

The problem seems to be that you don't want the count going 0 without
the interlock held.  This way, it wouldn't.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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