git: ext2fs: sync the device vnode before writing the clean flag on unmount

Aaron LI aly at crater.dragonflybsd.org
Fri Oct 23 06:19:05 PDT 2026


commit 18702bca2a2c17356cdc2513e4487746ae1ee9e6
Author: David Bidner <david at crap.solutions>
Date:   Thu Oct 22 14:09:51 2026 +0200

    ext2fs: sync the device vnode before writing the clean flag on unmount
    
    An inode freed by rmdir is deactivated during vflush(), after
    ext2_unmount()'s VFS_SYNC(), so its inode-bitmap update is only queued
    with bdwrite() and nothing writes it out.  e2fsck -fn then reports the
    inode still allocated and the group's free-inode count wrong.
    
    After vflush(), do what ffs_flushfiles() does: lock the device vnode,
    VOP_FSYNC() it with MNT_WAIT and return the error, before the group
    descriptors and the clean flag are written.  Test e2fs_ronly rather
    than MNT_RDONLY, which sys_mount() sets before a downgrade.
    
    This fixes unmount and forced unmount.  A read-write to read-only
    downgrade is not covered: the rmdir'd inode is not freed on that path
    at all (pre-existing).
    
    Reproducer: mount rw, mkdir d; rmdir d; sync; umount; e2fsck -fn.
    
    Bug: https://bugs.dragonflybsd.org/issues/3458

Summary of changes:
 sys/vfs/ext2fs/ext2_vfsops.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/18702bca2a2c17356cdc2513e4487746ae1ee9e6


-- 
DragonFly BSD source repository


More information about the Commits mailing list