[Haiku-commits] r31255 - haiku/trunk/src/add-ons/kernel/file_systems/bfs
axeld at BerliOS
axeld at mail.berlios.de
Fri Jun 26 17:03:44 CEST 2009
Author: axeld
Date: 2009-06-26 17:03:42 +0200 (Fri, 26 Jun 2009)
New Revision: 31255
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31255&view=rev
Modified:
haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp
haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp
Log:
* The block allocator will no longer try to fix a missing allocation on a
read-only volume. This fixes bug #3432.
* Journal::ReplayLog() will now return an error on a read-only device, rendering
read-only dirty volumes unmountable.
Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2009-06-26 14:54:54 UTC (rev 31254)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2009-06-26 15:03:42 UTC (rev 31255)
@@ -684,14 +684,20 @@
uint32 reservedBlocks = volume->Log().Start() + volume->Log().Length();
if (allocator->CheckBlocks(0, reservedBlocks) != B_OK) {
- Transaction transaction(volume, 0);
- if (groups[0].Allocate(transaction, 0, reservedBlocks) != B_OK) {
- FATAL(("could not allocate reserved space for block "
- "bitmap/log!\n"));
- volume->Panic();
+ if (volume->IsReadOnly()) {
+ FATAL(("Space for block bitmap or log area is not reserved "
+ "(volume is mounted read-only)!\n"));
} else {
- transaction.Done();
- FATAL(("space for block bitmap or log area was not reserved!\n"));
+ Transaction transaction(volume, 0);
+ if (groups[0].Allocate(transaction, 0, reservedBlocks) != B_OK) {
+ FATAL(("Could not allocate reserved space for block "
+ "bitmap/log!\n"));
+ volume->Panic();
+ } else {
+ transaction.Done();
+ FATAL(("Space for block bitmap or log area was not "
+ "reserved!\n"));
+ }
}
}
Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2009-06-26 14:54:54 UTC (rev 31254)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2009-06-26 15:03:42 UTC (rev 31255)
@@ -559,9 +559,14 @@
INFORM(("Replay log, disk was not correctly unmounted...\n"));
- if (fVolume->SuperBlock().flags != SUPER_BLOCK_DISK_DIRTY)
- INFORM(("log_start and log_end differ, but disk is marked clean - trying to replay log...\n"));
+ if (fVolume->SuperBlock().flags != SUPER_BLOCK_DISK_DIRTY) {
+ INFORM(("log_start and log_end differ, but disk is marked clean - "
+ "trying to replay log...\n"));
+ }
+ if (fVolume->IsReadOnly())
+ return B_READ_ONLY_DEVICE;
+
int32 start = fVolume->LogStart();
int32 lastStart = -1;
while (true) {
@@ -576,8 +581,9 @@
lastStart = start;
status_t status = _ReplayRunArray(&start);
- if (status < B_OK) {
- FATAL(("replaying log entry from %d failed: %s\n", (int)start, strerror(status)));
+ if (status != B_OK) {
+ FATAL(("replaying log entry from %d failed: %s\n", (int)start,
+ strerror(status)));
return B_ERROR;
}
start = start % fLogSize;
Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2009-06-26 14:54:54 UTC (rev 31254)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2009-06-26 15:03:42 UTC (rev 31255)
@@ -344,7 +344,7 @@
// check if the device size is large enough to hold the file system
off_t diskSize;
- if (opener.GetSize(&diskSize) < B_OK)
+ if (opener.GetSize(&diskSize) != B_OK)
RETURN_ERROR(B_ERROR);
if (diskSize < (NumBlocks() << BlockShift()))
RETURN_ERROR(B_BAD_VALUE);
@@ -368,7 +368,7 @@
// replaying the log is the first thing we will do on this disk
status = fJournal->ReplayLog();
- if (status < B_OK) {
+ if (status != B_OK) {
FATAL(("Replaying log failed, data may be corrupted, volume "
"read-only.\n"));
fFlags |= VOLUME_READ_ONLY;
@@ -379,7 +379,7 @@
}
status = fBlockAllocator.Initialize();
- if (status < B_OK) {
+ if (status != B_OK) {
FATAL(("could not initialize block bitmap allocator!\n"));
return status;
}
More information about the Haiku-commits
mailing list