From 65e04b057d095e47f9f132d726c9a5d3bac19bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 29 Jul 2009 23:46:56 +0000 Subject: [PATCH] * When a reentered fs function reuses a transaction of its caller, the Transaction::UnlockInodes() method was never called, leading to bug #4155. * In order to make sure that inodes are still going to be reverted, we actually need to move them into the parent transaction which we now do. This should fix #4155. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31952 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/Journal.cpp | 14 +++++++++++++- src/add-ons/kernel/file_systems/bfs/Journal.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) 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);