[XFS] Fix a case where attr2 format was being used unconditionally.

SGI-PV: 941645
SGI-Modid: xfs-linux-melb:xfs-kern:24566a

Signed-off-by: Nathan Scott <nathans@sgi.com>

+8 -3
+8 -3
fs/xfs/xfs_attr_leaf.c
··· 310 310 * Fix up the start offset of the attribute fork 311 311 */ 312 312 totsize -= size; 313 - if (totsize == sizeof(xfs_attr_sf_hdr_t) && !args->addname) { 313 + if (totsize == sizeof(xfs_attr_sf_hdr_t) && !args->addname && 314 + !(mp->m_flags & XFS_MOUNT_COMPAT_ATTR)) { 314 315 /* 315 316 * Last attribute now removed, revert to original 316 317 * inode format making all literal area available ··· 329 328 xfs_idata_realloc(dp, -size, XFS_ATTR_FORK); 330 329 dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize); 331 330 ASSERT(dp->i_d.di_forkoff); 332 - ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || args->addname); 331 + ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || args->addname || 332 + (mp->m_flags & XFS_MOUNT_COMPAT_ATTR)); 333 333 dp->i_afp->if_ext_max = 334 334 XFS_IFORK_ASIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t); 335 335 dp->i_df.if_ext_max = ··· 739 737 + name_loc->namelen 740 738 + INT_GET(name_loc->valuelen, ARCH_CONVERT); 741 739 } 742 - if (bytes == sizeof(struct xfs_attr_sf_hdr)) 740 + if (!(dp->i_mount->m_flags & XFS_MOUNT_COMPAT_ATTR) && 741 + (bytes == sizeof(struct xfs_attr_sf_hdr))) 743 742 return(-1); 744 743 return(xfs_attr_shortform_bytesfit(dp, bytes)); 745 744 } ··· 778 775 goto out; 779 776 780 777 if (forkoff == -1) { 778 + ASSERT(!(dp->i_mount->m_flags & XFS_MOUNT_COMPAT_ATTR)); 779 + 781 780 /* 782 781 * Last attribute was removed, revert to original 783 782 * inode format making all literal area available