Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: growfs not aware of sb_meta_uuid

Adding this simple change to xfstests:common/rc::_scratch_mkfs_xfs:

+ if [ $mkfs_status -eq 0 ]; then
+ xfs_admin -U generate $SCRATCH_DEV > /dev/null
+ fi

triggers all sorts of errors in xfstests. xfs/104 is an example,
where growfs fails with a UUID mismatch corruption detected by
xfs_agf_write_verify() when trying to write the first new AG
headers.

Fix this problem by making sure we copy the sb_meta_uuid into new
metadata written by growfs.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>

authored by

Dave Chinner and committed by
Dave Chinner
ac383de2 bbf155ad

+3 -3
+3 -3
fs/xfs/xfs_fsops.c
··· 250 250 agf->agf_freeblks = cpu_to_be32(tmpsize); 251 251 agf->agf_longest = cpu_to_be32(tmpsize); 252 252 if (xfs_sb_version_hascrc(&mp->m_sb)) 253 - uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_uuid); 253 + uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); 254 254 255 255 error = xfs_bwrite(bp); 256 256 xfs_buf_relse(bp); ··· 273 273 if (xfs_sb_version_hascrc(&mp->m_sb)) { 274 274 agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC); 275 275 agfl->agfl_seqno = cpu_to_be32(agno); 276 - uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_uuid); 276 + uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); 277 277 } 278 278 279 279 agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, bp); ··· 309 309 agi->agi_newino = cpu_to_be32(NULLAGINO); 310 310 agi->agi_dirino = cpu_to_be32(NULLAGINO); 311 311 if (xfs_sb_version_hascrc(&mp->m_sb)) 312 - uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_uuid); 312 + uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); 313 313 if (xfs_sb_version_hasfinobt(&mp->m_sb)) { 314 314 agi->agi_free_root = cpu_to_be32(XFS_FIBT_BLOCK(mp)); 315 315 agi->agi_free_level = cpu_to_be32(1);