XFS appears to be more strict than the Linux vfs layer wrt whether a
process can chgrp a file when it's not the owner but still in the same
group -- XFS doesn't allow it and requires CAP_FOWNER instead.
This fix rorders the tests so that the chgrp operations occur before the
chown operations happen, avoiding the difference in requirements between
XFS and linux's vfs.