Perturbation analysis of the canonical subspaces