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