From b4f586280a6bfaf8c88b691731e9932047cf9071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 25 Nov 2003 18:32:41 +0000 Subject: [PATCH] Work-around for a bug in BeOS concerning the cache - it's not a complete cure, though. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5481 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/storage/virtualdrive/virtualdrive.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tests/kits/storage/virtualdrive/virtualdrive.cpp b/src/tests/kits/storage/virtualdrive/virtualdrive.cpp index e6aa559285..ecd9535441 100644 --- a/src/tests/kits/storage/virtualdrive/virtualdrive.cpp +++ b/src/tests/kits/storage/virtualdrive/virtualdrive.cpp @@ -245,6 +245,14 @@ init_device_info(int32 index, virtual_drive_info *initInfo) // Disable caching for underlying file! (else this driver will deadlock) // We probably cannot resize the file once the cache has been disabled! + // This applies to BeOS only: + // Work around a bug in BFS: the file is not synced before the cache is + // turned off, and thus causing possible inconsistencies. + // Unfortunately, this only solves one half of the issue; there is + // no way to remove the blocks in the cache, so changes made to the + // image have the chance to get lost. + fsync(fd); + // This is a special reserved ioctl() opcode not defined anywhere in // the Be headers. if (ioctl(fd, 10000) != 0) {