From dd825d55562bcd6eb9f1d5dae3cb11adddbdff10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 29 Jul 2009 21:37:53 +0000 Subject: [PATCH] * 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 --- src/add-ons/kernel/file_systems/bfs/Journal.cpp | 4 +++- src/add-ons/kernel/file_systems/bfs/Journal.h | 12 ++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Journal.cpp b/src/add-ons/kernel/file_systems/bfs/Journal.cpp index 05757ba96f..09ff73f6a7 100644 --- a/src/add-ons/kernel/file_systems/bfs/Journal.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Journal.cpp @@ -996,6 +996,8 @@ Journal::Unlock(Transaction* owner, bool success) status_t status = _TransactionDone(success); if (status != B_OK) return status; + + fOwner->UnlockInodes(success); } fTimestamp = system_time(); @@ -1178,7 +1180,7 @@ Transaction::RemoveInode(Inode* inode) void -Transaction::_UnlockInodes(bool success) +Transaction::UnlockInodes(bool success) { while (Inode* inode = fLockedInodes.RemoveHead()) { if (success) { diff --git a/src/add-ons/kernel/file_systems/bfs/Journal.h b/src/add-ons/kernel/file_systems/bfs/Journal.h index 9ebe797941..b867cb0009 100644 --- a/src/add-ons/kernel/file_systems/bfs/Journal.h +++ b/src/add-ons/kernel/file_systems/bfs/Journal.h @@ -110,10 +110,8 @@ public: ~Transaction() { - if (fJournal != NULL) { + if (fJournal != NULL) fJournal->Unlock(this, false); - _UnlockInodes(false); - } } status_t Start(Volume* volume, off_t refBlock); @@ -124,10 +122,8 @@ public: status_t status = B_OK; if (fJournal != NULL) { status = fJournal->Unlock(this, true); - if (status == B_OK) { - _UnlockInodes(true); + if (status == B_OK) fJournal = NULL; - } } return status; } @@ -183,13 +179,13 @@ public: void AddInode(Inode* inode); void RemoveInode(Inode* inode); + void UnlockInodes(bool success); + private: Transaction(const Transaction& other); Transaction& operator=(const Transaction& other); // no implementation - void _UnlockInodes(bool success); - Journal* fJournal; InodeList fLockedInodes; };