[lvc-project] [PATCH 2/2] ocfs2: validate cl_bpc in allocator inodes to prevent divide-by-zero

Deepanshu Kartikey kartikey406 at gmail.com
Thu Oct 30 14:04:52 MSK 2025


Hi Joseph,

Thank you for the solution! I'll implement the validation as you suggested:

  if (OCFS2_SB(sb)->bitmap_blkno &&
      (OCFS2_SB(sb)->bitmap_blkno != le64_to_cpu(di->i_blkno)) &&
      (le16_to_cpu(cl->cl_bpc) != expected_bpc))

This elegantly handles:
1. Early initialization (when bitmap_blkno is not yet set)
2. Skipping validation for global_bitmap (which uses cl_bpc=1 by design)
3. Validating all other chain allocators

I'll test this with all block sizes (512, 1024, 2048, 4096) and verify
they all mount successfully.

Dmitry, should I send v4 as a standalone patch, or would you prefer to
integrate this fix into your combined series?

Thanks,
Deepanshu



More information about the lvc-project mailing list