Guidance on I/O to journal inode during ext2 mount
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 29 Jul 2025 15:42:52 UTC
Hi, I'm working on adding journaling to the ext2fs for GSoC and would appreciate some guidance on the correct approach for handling I/O during the mount process. For context*, *the journal recovery is initiated from ext2_mountfs in ext2_vfsops.c, right after the superblock and group descriptors have been read and the basic mount structures are populated. During recovery replay, I need to read the journal inode blocks to replay properly. However, when calling bread on blocks 12 and higher I eventually get a page fault on the bmaparray function when accessing bp->b_data. I find this strange since reading the direct block 0-11 has no issues My approach was to get the journal inode's vnode via VFS_VGET and then use bread to read its blocks. This fails with a kernel panic when trying to read an indirect block. The panic (page fault) occurs within ext2_bmaparray specifically when trying to access bp->b_data after readindir has supposedly read an indirect block from disk. I find this strange since calling breads on the direct blocks have no issue and the panic is a page fault. Also when calling bread on blocks 12 and higher after the the filesystem is fully mounted works fine. This leads me to believe that after the ext2fs mount call, the VFS layer does some further initializations that are required for bread to be stable. Is this understanding correct? Is it expected that bread would be unstable during the mountfs phase? Is there a specific VFS function or flag I should be using to "activate" the vnode for I/O before I start recovery? Thank you for any guidance or insight you can provide, Pau.