[haiku-gsoc] Re: bfs deadlock in different path of bfs_free_cookie

  • From: "Salvatore Benedetto" <emitrax@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Mon, 18 Aug 2008 20:37:42 +0000

2008/8/18 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
> "Salvatore Benedetto" <emitrax@xxxxxxxxx> wrote:
>> By browsing the code the easy way to fix this seems to be
>> inverting the two lines below in the Transaction destructor.
>>  _UnlockInodes, in fact, starts a new transaction, thus
>> trying to reacquire the journal lock after locking the inodes in
>> write mode.
>>
>>     ~Transaction()
>>     {
>>         if (fJournal != NULL) {
>>             fJournal->Unlock(this, false);
>>             _UnlockInodes();
>>         }
>>     }
>
> Indeed, switching the two lines should do the trick - any transaction
> started in _UnlockInodes() will then reuse the current transaction,
> instead of trying to start a new one.
> Nice one!

Ok, I'll go ahead and commit the change.
Thanks for reviewng. After sending the email I actually thought
that switching the lines would cause another deadlock as the journal
lock would be reacquired, but that's not the case.

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

Other related posts: