diff --git a/src/add-ons/kernel/file_systems/bfs/Journal.cpp b/src/add-ons/kernel/file_systems/bfs/Journal.cpp index 09ff73f6a7..cf557ed8eb 100644 --- a/src/add-ons/kernel/file_systems/bfs/Journal.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Journal.cpp @@ -1006,7 +1006,8 @@ Journal::Unlock(Transaction* owner, bool success) if (fSeparateSubTransactions && recursive_lock_get_recursion(&fLock) == 1) fSeparateSubTransactions = false; - } + } else + owner->MoveInodesTo(fOwner); recursive_lock_unlock(&fLock); return B_OK; @@ -1202,3 +1203,14 @@ Transaction::UnlockInodes(bool success) } } + +/*! Move the inodes into the parent transaction. This is needed only to make + sure they will still be reverted in case the transaction is aborted. +*/ +void +Transaction::MoveInodesTo(Transaction* transaction) +{ + while (Inode* inode = fLockedInodes.RemoveHead()) { + transaction->fLockedInodes.Add(inode); + } +} diff --git a/src/add-ons/kernel/file_systems/bfs/Journal.h b/src/add-ons/kernel/file_systems/bfs/Journal.h index b867cb0009..9bc5858637 100644 --- a/src/add-ons/kernel/file_systems/bfs/Journal.h +++ b/src/add-ons/kernel/file_systems/bfs/Journal.h @@ -180,6 +180,7 @@ public: void RemoveInode(Inode* inode); void UnlockInodes(bool success); + void MoveInodesTo(Transaction* transaction); private: Transaction(const Transaction& other);