Re: [PATCH 5/5] xfs: verify buffer, inode, and dquot items every tx commit

Christoph Hellwig
2024-06-13T05:08:03Z

On Wed, Jun 12, 2024 at 10:47:50AM -0700, Darrick J. Wong wrote:
> + struct xfs_mount *mp = ip->i_mount;
> + struct xfs_dinode *dip;
> + xfs_failaddr_t fa;
> +
> + dip = kzalloc(mp->m_sb.sb_inodesize, GFP_KERNEL | GFP_NOFS);
> + if (!dip) {
> + ASSERT(dip != NULL);
> + return;
> + }
> +
> + xfs_inode_to_disk(ip, dip, 0);
> + xfs_dinode_calc_crc(mp, dip);
> + fa = xfs_dinode_verify(mp, ip->i_ino, dip);
> + if (fa) {
> + xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, dip,
> + sizeof(*dip), fa);
> + xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
> + ASSERT(fa == NULL);
> + }
> + kfree(dip);

Doing abother malloc and per committed inode feels awfully expensive.

Overall this feels like the wrong tradeoff, at least for generic
debug builds.