⬢ DragonFlyBSD Kernel Audit
DF-3176 / fix.diff
← back to finding ↓ download raw
--- a/sys/vfs/ext2fs/ext2_inode.c	2026-06-29 12:51:19.000000000 +0000
+++ b/sys/vfs/ext2fs/ext2_inode.c	2026-10-26 03:28:45.669473983 +0000
@@ -78,6 +78,8 @@
 	ip = VTOI(vp);
 	if ((ip->i_flag & IN_MODIFIED) == 0 && waitfor == 0)
 		return (0);
+	int saved_flags = ip->i_flag;
+
 	ip->i_flag &= ~(IN_LAZYACCESS | IN_LAZYMOD | IN_MODIFIED);
 	fs = ip->i_e2fs;
 	if (fs->e2fs_ronly)
@@ -85,12 +87,17 @@
 	if ((error = bread(ip->i_devvp,
 	    fsbtodoff(fs, ino_to_fsba(fs, ip->i_number)),
 	    (int)fs->e2fs_bsize, &bp)) != 0) {
+		/* keep the inode dirty so a later update retries */
+		ip->i_flag |= (saved_flags &
+		    (IN_LAZYACCESS | IN_LAZYMOD | IN_MODIFIED));
 		brelse(bp);
 		return (error);
 	}
 	error = ext2_i2ei(ip, (struct ext2fs_dinode *)((char *)bp->b_data +
 	    EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)));
 	if (error) {
+		ip->i_flag |= (saved_flags &
+		    (IN_LAZYACCESS | IN_LAZYMOD | IN_MODIFIED));
 		brelse(bp);
 		return (error);
 	}