[haiku-gsoc] Re: BFS bug #2

2008/6/28 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
> "Salvatore Benedetto" <emitrax@xxxxxxxxx> wrote:
>> I think I hit a second bug while checking out haiku source code.
>> Didn't take any screenshots this time, but this is what happened:
>>
>> - svn calls bfs_rename, which first lock the volume and then try to
>> acquire
>> the journal lock by creating a Transaction object.
>>
>> - The daemon thread on the other hand, somehow calls the bfs_unlink
>> function
>> (btw I didn't bother to write down its whole stack trace because I
>> thought I'd figure out how
>> it got to bfs_unlink, but I couldn't, so if any of you can shine some
>> light on this I'd really
>> appreciate it). The bfs_unlink function first locks the journal area
>> by creating a transaction
>> and then by calling Inode::Remove tries to acquire the volume lock,
>> which is already held
>> by svn, thus the deadlock in the file system.
>>
>> I'm fixing it now. Let me know if you have any suggestions about how
>> to fix it.
>
> Nice one! The volume lock should be the outer lock, so the caller of
> Inode::Remove() should make sure it's locked.

I actually thuoght that the transaction lock should be held first, because
that's how it's done in the rest of the code, so I simply moved up the
transaction
creation object before the volume lock is acquired.

But if you say so, I'll lock the volume before the transaction.

>
> Bye,
>   Axel.
>
>
>


Regards,
-- 
Salvatore Benedetto (a.k.a. emitrax)
Student of Computer Engineer
University of Pisa
www.haiku-os.it

Other related posts: