From owner-freebsd-hackers Wed Oct 13 17:47: 2 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from marcy.nas.nasa.gov (marcy.nas.nasa.gov [129.99.113.17]) by hub.freebsd.org (Postfix) with ESMTP id 15C3C14F2F for ; Wed, 13 Oct 1999 17:46:54 -0700 (PDT) (envelope-from wrstuden@marcy.nas.nasa.gov) Received: from localhost (wrstuden@localhost) by marcy.nas.nasa.gov (8.9.3/NAS8.8.7n) with SMTP id RAA10555; Wed, 13 Oct 1999 17:46:38 -0700 (PDT) Date: Wed, 13 Oct 1999 17:46:37 -0700 (PDT) From: Bill Studenmund To: Zhihui Zhang Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: The meaning of LK_INTERLOCK In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 13 Oct 1999, Zhihui Zhang wrote: > > The comments say that the flag LK_INTERLOCK means "unlock passed simple > lock after getting lk_interlock". Under what circumstances are we going to > need two simple locks (release the first one after getting the second > one)? I can not understand this easily from the source code. > > Any help is appreciated. The idea is that the other interlock protects something whose value determines if we want to grab the lock. For example, vn_lock() grabs the vnode interlock and looks at v_flag. If VXLOCK is clear, we then call VOP_LOCK. By doing this interlock trick, no one can get in and modify the flags before we've entered the lock manager. Take care, Bill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message