DF-3123 / fix.diff
--- sys/vfs/ext2fs/ext2_htree.c.orig +++ sys/vfs/ext2fs/ext2_htree.c @@ -451,10 +451,11 @@ ext2_htree_writebuf(struct inode* ip, struct ext2fs_ht for (i = 0; i < info->h_levels_num; i++) { struct buf *bp = info->h_levels[i].h_bp; ext2_dx_csum_set(ip, (struct ext2fs_direct_2 *)bp->b_data); + info->h_levels[i].h_bp = NULL; error = bwrite(bp); if (error) return (error); } @@ -879,9 +880,11 @@ ext2_htree_add_entry(struct vnode *dvp, struct ext2fs ext2_htree_insert_entry_to_level(&info.h_levels[0], split_hash, blknum); /* Write new index node to disk */ ext2_dx_csum_set(ip, (struct ext2fs_direct_2 *)dst_bp->b_data); error = bwrite(dst_bp); + dst_bp = NULL; /* bwrite consumed it */ ip->i_flag |= IN_CHANGE | IN_UPDATE; if (error) goto finish; @@ -935,6 +938,7 @@ ext2_htree_add_entry(struct vnode *dvp, struct ext2fs /* Write the target directory block */ ext2_dirent_csum_set(ip, (struct ext2fs_direct_2 *)bp->b_data); error = bwrite(bp); + bp = NULL; /* bwrite consumed it */ ip->i_flag |= IN_CHANGE | IN_UPDATE; if (error) goto finish; |