Permit CacheManager StreamFile extension if dirty blocks are pending.
authorshort <>
Wed, 15 Oct 2003 18:59:35 +0000 (18:59 +0000)
committershort <>
Wed, 15 Oct 2003 18:59:35 +0000 (18:59 +0000)
 - Required by ntfs.sys of NT-5.1sp1 journalling file (?) extension.
 - Bugreported by Martin Drab.

src/libcaptive/cc/privatebcbpin.c
src/libcaptive/cc/sharedcachemap.c

index fa77e1c..c51c641 100644 (file)
@@ -173,8 +173,15 @@ static void captive_private_bcb_pin_object_FileSizes_changed(CaptiveSharedCacheM
        g_return_if_fail(CAPTIVE_PRIVATE_BCB_OBJECT(captive_private_bcb_pin_object)->SharedCacheMap
                        ==captive_shared_cache_map_object);
 
-       /* 'AllocationSize' must not change if any map/pin Bcbs exist. */
-       g_assert(AllocationSize==captive_shared_cache_map_object->AllocationSize);
+       /* ntfs.sys of NT-5.1sp1 may extend StreamFileObject while dirty pins exist.
+        * How to extend SharedCacheMap size without changing the memory location?
+        * I hope ntfs.sys does not expect long-term absolute position of its
+        * StreamFileObject:
+        */
+       if (!(captive_shared_cache_map_object->FileObject->Flags&FO_STREAM_FILE)) {
+               /* 'AllocationSize' must not change if any map/pin Bcbs exist. */
+               g_assert(AllocationSize==captive_shared_cache_map_object->AllocationSize);
+               }
 }
 
 static void captive_private_bcb_pin_object_purge(CaptiveSharedCacheMapObject *captive_shared_cache_map_object,
index 9061da0..f9163ee 100644 (file)
@@ -184,9 +184,16 @@ size_new_big:
        if (size_old!=size_new) {
 gpointer buffer_new;
 
-               /* These two assertions should be already catched by pin/map signal handlers. */
-               g_assert(!captive_shared_cache_map_object->map);
-               g_assert(!g_hash_table_size(captive_shared_cache_map_object->pin_hash));
+               /* ntfs.sys of NT-5.1sp1 may extend StreamFileObject while dirty pins exist.
+                * How to extend SharedCacheMap size without changing the memory location?
+                * I hope ntfs.sys does not expect long-term absolute position of its
+                * StreamFileObject:
+                */
+               if (!(captive_shared_cache_map_object->FileObject->Flags&FO_STREAM_FILE)) {
+                       /* These two assertions should be already catched by pin/map signal handlers. */
+                       g_assert(!captive_shared_cache_map_object->map);
+                       g_assert(!g_hash_table_size(captive_shared_cache_map_object->pin_hash));
+                       }
 
                if (AllocationSize) {
 gpointer base;