For a given class of modules [Formula: see text], let [Formula: see text] be the class of exact complexes having all cycles in [Formula: see text], and dw([Formula: see text]) the class of complexes with all components in [Formula: see text]. Denote by [Formula: see text][Formula: see text] the class of Gorenstein injective R-modules. We prove that the following are equivalent over any ring R: every exact complex of injective modules is totally acyclic; every exact complex of Gorenstein injective modules is in [Formula: see text]; every complex in dw([Formula: see text][Formula: see text]) is dg-Gorenstein injective. The analogous result for complexes of flat and Gorenstein flat modules also holds over arbitrary rings. If the ring is n-perfect for some integer n ≥ 0, the three equivalent statements for flat and Gorenstein flat modules are equivalent with their counterparts for projective and projectively coresolved Gorenstein flat modules. We also prove the following characterization of Gorenstein rings. Let R be a commutative coherent ring; then the following are equivalent: (1) every exact complex of FP-injective modules has all its cycles Ding injective modules; (2) every exact complex of flat modules is F-totally acyclic, and every R-module M such that M+ is Gorenstein flat is Ding injective; (3) every exact complex of injectives has all its cycles Ding injective modules and every R-module M such that M+ is Gorenstein flat is Ding injective. If R has finite Krull dimension, statements (1)–(3) are equivalent to (4) R is a Gorenstein ring (in the sense of Iwanaga).