  We investigate the stability criterions for perfect fluid in $f(R)$ theories
which is an important generalization of general relativity. Firstly, using
Wald's general variation principle, we recast Seifert's work and obtain the
dynamical stability criterion. Then using our generalized thermodynamical
criterion, we obtain the concrete expressions of the criterion. We show that
the dynamical stability criterion is exactly the same as the thermodynamical
stability criterion. This result suggests that there is an inherent connection
between the thermodynamics and gravity in $f(R)$ theories. It should be pointed
out that using the thermodynamical method to determine the stability for
perfect fluid is simpler and more directly than the dynamical method.
