For an odd prime p,we give a criterion for finite p-groups whose nonnormal subgroups are metacyclic,and based on the criterion,the p-groups whose nonnormal subgroups are metacyclic are classified up to isomorphism.This solves a problem proposed by Berkovich.