Date: Fri, 02 May 1997 14:00:39 +0200 From: Poul-Henning Kamp <phk@dk.tfs.com> To: Peter Dufault <dufault@hda.com> Cc: phk@dk.tfs.com (Poul-Henning Kamp), current@freebsd.org Subject: Re: vnode->v_usage Message-ID: <220.862574439@critter> In-Reply-To: Your message of "Fri, 02 May 1997 07:24:54 EDT." <199705021124.HAA27754@hda.hda.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <199705021124.HAA27754@hda.hda.com>, Peter Dufault writes: >The first unlock won't work since a second thread can come in and >decide to do the same move. Obviously you have a lock ordering issue >with the nested lock and you have to define the ordering. see below for my solution. >Moving items between two lists should be atomic - it is common >and lends itself to clean implementation. It's actually the same list in this case... >Aside: how about making the queues truly opaque while you're doing this? >Then you have a single place to enable locking hierarchy violation detection, >*CAS types of implementations, etc. I don't think that would be very easy. On the other hand, there are very few pieces of code manipulating the vnode free list, do it's hardly worth the effort. Or did I misunderstand you ? Poul-Henning void vtouch(vp) struct vnode *vp; { simple_lock(&vp->v_interlock); if (vp->v_usecount) { simple_unlock(&vp->v_interlock); return; } if (simple_lock_try(&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); } -- Poul-Henning Kamp | phk@FreeBSD.ORG FreeBSD Core-team. http://www.freebsd.org/~phk | phk@login.dknet.dk Private mailbox. whois: [PHK] | phk@tfs.com TRW Financial Systems, Inc. Power and ignorance is a disgusting cocktail.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?220.862574439>