* The inode list link was supposed to be secured by the journal log - so it was

definitely not a good idea to move _UnlockInodes() after the Journal::Unlock()
  call (which was done to achieve a revertable inode).
* Instead, Journal::Unlock() is now responsible for calling the now public
  Transaction::UnlockInodes(), and always does this at the right time while
  holding the journal log.
* While I don't understand how #4155 can happen, this bug should be the one that
  caused it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31944 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-07-29 21:37:53 +00:00
parent 529c716df3
commit dd825d5556
2 changed files with 7 additions and 9 deletions
@@ -996,6 +996,8 @@ Journal::Unlock(Transaction* owner, bool success)
status_t status = _TransactionDone(success); status_t status = _TransactionDone(success);
if (status != B_OK) if (status != B_OK)
return status; return status;
fOwner->UnlockInodes(success);
} }
fTimestamp = system_time(); fTimestamp = system_time();
@@ -1178,7 +1180,7 @@ Transaction::RemoveInode(Inode* inode)
void void
Transaction::_UnlockInodes(bool success) Transaction::UnlockInodes(bool success)
{ {
while (Inode* inode = fLockedInodes.RemoveHead()) { while (Inode* inode = fLockedInodes.RemoveHead()) {
if (success) { if (success) {
@@ -110,10 +110,8 @@ public:
~Transaction() ~Transaction()
{ {
if (fJournal != NULL) { if (fJournal != NULL)
fJournal->Unlock(this, false); fJournal->Unlock(this, false);
_UnlockInodes(false);
}
} }
status_t Start(Volume* volume, off_t refBlock); status_t Start(Volume* volume, off_t refBlock);
@@ -124,10 +122,8 @@ public:
status_t status = B_OK; status_t status = B_OK;
if (fJournal != NULL) { if (fJournal != NULL) {
status = fJournal->Unlock(this, true); status = fJournal->Unlock(this, true);
if (status == B_OK) { if (status == B_OK)
_UnlockInodes(true);
fJournal = NULL; fJournal = NULL;
}
} }
return status; return status;
} }
@@ -183,13 +179,13 @@ public:
void AddInode(Inode* inode); void AddInode(Inode* inode);
void RemoveInode(Inode* inode); void RemoveInode(Inode* inode);
void UnlockInodes(bool success);
private: private:
Transaction(const Transaction& other); Transaction(const Transaction& other);
Transaction& operator=(const Transaction& other); Transaction& operator=(const Transaction& other);
// no implementation // no implementation
void _UnlockInodes(bool success);
Journal* fJournal; Journal* fJournal;
InodeList fLockedInodes; InodeList fLockedInodes;
}; };