For a given class of modules A,let (A) be the class of exact complexes having all cycles in A,and dw(A) the class of complexes with all components in A.Denote by (G)I 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 (G)(I);every complex in dw((G)I) 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).