[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

hurd/ext2fs/getblk.c:103 assertion



Filling an ext2 file system results in the following assertion:

# cat /dev/random > large.file
ext2fs: ../../ext2fs/getblk.c:103 ext2_alloc_block: Assertion 'result >= ..........'

It is permissible for ext2_alloc_block to return 0 as an ENOSPC indication but the assertion doesn't take that into account. Please consider the following patch:

diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c
index 26ac145..f2a1f10 100644
--- a/ext2fs/getblk.c
+++ b/ext2fs/getblk.c
@@ -99,9 +99,12 @@ ext2_alloc_block (struct node *node, block_t goal, int zero)
         &diskfs_node_disknode (node)->info.i_prealloc_block);
     }

-  /* Trap trying to allocate superblock, block group descriptor table, or beyond the end */
-  assert_backtrace (result >= group_desc_block_end
-                && result < store->size >> log2_block_size);
+  if (result)
+    {
+      /* Trap trying to allocate superblock, block group descriptor table, or beyond the end */
+      assert_backtrace (result >= group_desc_block_end
+                       && result < store->size >> log2_block_size);
+    }
 #else
   result = ext2_new_block (goal, 0, 0);
 #endif

Regards,

Mike Kelly.


Reply to: