Subject: Re: sleeping in VOP_READ/WRITE
To: None <tech-kern@netbsd.org>
From: Bill Studenmund <wrstuden@nas.nasa.gov>
List: tech-kern
Date: 02/18/1999 12:33:10
On Wed, 17 Feb 1999, Bill Studenmund wrote:

> My question is if I should sleep with the vnode for the file still locked.
> It is locked when entering the VOP_READ/WRITE call. Would it be EVIL for
> me to unlock it while sleeping, and then re-lock it before exiting?

And the answer is (drum roll)......

Unlocked. Otherwise you can start "the race for root." Any name lookup on
this vnode would block if the node were locked. That would leave the
parent directory locked. Any name lookup there would lock its parent. And
so on until the root node is locked. Then bad things happen!

Take care,

Bill