From d06cc6e3861157b83893010b42d7c47a65197dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 29 Jul 2008 16:26:47 +0000 Subject: [PATCH] * Unmounting a volume didn't wait for the block allocator's initializer thread. * This fixed bug #2541. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26679 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp | 9 +++++++++ src/add-ons/kernel/file_systems/bfs/BlockAllocator.h | 2 ++ src/add-ons/kernel/file_systems/bfs/Volume.cpp | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index f0ab1ce7e7..4304d8b7f1 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -626,6 +626,15 @@ BlockAllocator::_Initialize(BlockAllocator *allocator) } +void +BlockAllocator::Uninitialize() +{ + // We only have to make sure that the initializer thread isn't running + // anymore. + mutex_lock(&fLock); +} + + status_t BlockAllocator::AllocateBlocks(Transaction &transaction, int32 group, uint16 start, uint16 maximum, uint16 minimum, block_run &run) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h index 21fad7792c..2fe0487de8 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h @@ -27,6 +27,8 @@ class BlockAllocator { status_t Initialize(bool full = true); status_t InitializeAndClearBitmap(Transaction &transaction); + void Uninitialize(); + status_t AllocateForInode(Transaction &transaction, const block_run *parent, mode_t type, block_run &run); status_t Allocate(Transaction &transaction, Inode *inode, off_t numBlocks, diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.cpp b/src/add-ons/kernel/file_systems/bfs/Volume.cpp index ac0cee8fc6..9ef825447f 100644 --- a/src/add-ons/kernel/file_systems/bfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Volume.cpp @@ -429,6 +429,8 @@ Volume::Unmount() // Unlike in BeOS, we need to put the reference to our root node ourselves put_vnode(fVolume, ToVnode(Root())); + fBlockAllocator.Uninitialize(); + // This will also flush the log & all blocks to disk delete fJournal; fJournal = NULL;