extra_mon_dispatch() and debugfs' foo_show functions dereference
fsc->mdsc. we should clean up fsc->client->extra_mon_dispatch
and debugfs before destroying fsc->mds.
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
 void ceph_mdsc_destroy(struct ceph_fs_client *fsc)
 {
        struct ceph_mds_client *mdsc = fsc->mdsc;
-
        dout("mdsc_destroy %p\n", mdsc);
-       ceph_mdsc_stop(mdsc);
 
        /* flush out any connection work with references to us */
        ceph_msgr_flush();
 
+       ceph_mdsc_stop(mdsc);
+
        fsc->mdsc = NULL;
        kfree(mdsc);
        dout("mdsc_destroy %p done\n", mdsc);
 
 
        destroy_mount_options(fsc->mount_options);
 
-       ceph_fs_debugfs_cleanup(fsc);
-
        ceph_destroy_client(fsc->client);
 
        kfree(fsc);
 
        ceph_mdsc_pre_umount(fsc->mdsc);
        generic_shutdown_super(s);
+
+       fsc->client->extra_mon_dispatch = NULL;
+       ceph_fs_debugfs_cleanup(fsc);
+
        ceph_mdsc_destroy(fsc);
 
        destroy_fs_client(fsc);