xfs/007: fix regressions on V4 filesystems
[xfstests-dev.git] / tests / xfs / 007
index d1946524e8136903494248a1b3a5508266e11ce3..4f864100fde32da2e72985830faf146a96fcdac1 100755 (executable)
@@ -40,11 +40,28 @@ do_test()
 
        _qmount
        echo "*** turn off $off_opts quotas"
 
        _qmount
        echo "*** turn off $off_opts quotas"
-       xfs_quota -x -c "off -$off_opts" $SCRATCH_MNT
+       $XFS_QUOTA_PROG -x -c "off -$off_opts" $SCRATCH_MNT
+
+       # Remount the filesystem with no quota options to force quotas off.
+       # This takes care of newer kernels where quotaoff clears the superblock
+       # quota enforcement flags but doesn't shut down accounting.
        _scratch_unmount
        _qmount_option ""
        _scratch_mount
        _scratch_unmount
        _qmount_option ""
        _scratch_mount
-       xfs_quota -x -c "remove -$off_opts" $SCRATCH_MNT
+
+       rm_commands=(-x -c "remove -$off_opts")
+
+       # Remounting a V4 fs with no quota options means that the internal
+       # gquotino -> pquotino remapping does not happen.  If we want to
+       # truncate the "project" quota file we must run remove -g.  However,
+       # xfs_quota has a nasty sharp edge wherein passing '-g' and '-p' only
+       # results in a QUOTARM call for the group quota file, so we must make
+       # a separate remove call.
+       [ $_fs_has_crcs == 0 ] && [ "$off_opts" = "up" ] && \
+               rm_commands+=(-c "remove -g")
+
+       $XFS_QUOTA_PROG "${rm_commands[@]}" $SCRATCH_MNT
+
        echo "*** umount"
        _scratch_unmount
 
        echo "*** umount"
        _scratch_unmount