Whamcloud - gitweb
LU-10224 obd: free obd_svc_stats when all users are gone 49/30249/4
authorBruno Faccini <bruno.faccini@intel.com>
Tue, 28 Nov 2017 15:15:16 +0000 (10:15 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 11 Dec 2017 03:45:42 +0000 (03:45 +0000)
During object device shutdown obd_svc_stats must only be freed
after all access methods from user-land are no longer possible
to prevent any race and further crash.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: Iea4f5b0486779c1721c90f32538af1a723f76a79
Reviewed-on: https://review.whamcloud.com/30249
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Tested-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdc/mdc_request.c
lustre/osc/osc_request.c
lustre/osp/lwp_dev.c
lustre/osp/osp_dev.c
lustre/ptlrpc/lproc_ptlrpc.c

index ba2ce09..5349b11 100644 (file)
@@ -2555,7 +2555,6 @@ err_changelog_cleanup:
        mdc_llog_finish(obd);
 err_llog_cleanup:
        ptlrpc_lprocfs_unregister_obd(obd);
-       lprocfs_obd_cleanup(obd);
        lprocfs_free_md_stats(obd);
 
        osc_cleanup_common(obd);
@@ -2600,7 +2599,6 @@ static int mdc_precleanup(struct obd_device *obd)
 
        obd_cleanup_client_import(obd);
        ptlrpc_lprocfs_unregister_obd(obd);
-       lprocfs_obd_cleanup(obd);
        lprocfs_free_md_stats(obd);
        mdc_llog_finish(obd);
        RETURN(0);
index 4012917..9509ff2 100644 (file)
@@ -3077,7 +3077,6 @@ static int osc_precleanup(struct obd_device *obd)
        osc_precleanup_common(obd);
 
        ptlrpc_lprocfs_unregister_obd(obd);
-       lprocfs_obd_cleanup(obd);
        RETURN(0);
 }
 
index e4e6364..2c05352 100644 (file)
@@ -388,7 +388,6 @@ static struct lu_device *lwp_device_fini(const struct lu_env *env,
 
        LASSERT(m->lpd_obd);
        ptlrpc_lprocfs_unregister_obd(m->lpd_obd);
-       lprocfs_obd_cleanup(m->lpd_obd);
 
        rc = client_obd_cleanup(m->lpd_obd);
        LASSERTF(rc == 0, "error %d\n", rc);
index 4c7f791..3d23058 100644 (file)
@@ -1237,7 +1237,6 @@ out_fid:
        obd_fid_fini(osp->opd_obd);
 out_proc:
        ptlrpc_lprocfs_unregister_obd(obd);
-       lprocfs_obd_cleanup(obd);
        if (osp->opd_symlink)
                lprocfs_remove(&osp->opd_symlink);
        client_obd_cleanup(obd);
@@ -1358,7 +1357,6 @@ static struct lu_device *osp_device_fini(const struct lu_env *env,
 
        LASSERT(osp->opd_obd);
        ptlrpc_lprocfs_unregister_obd(osp->opd_obd);
-       lprocfs_obd_cleanup(osp->opd_obd);
 
        if (osp->opd_connect_mdt) {
                struct client_obd *cli = &osp->opd_obd->u.cli;
index a1829b0..b4c7da4 100644 (file)
@@ -1240,6 +1240,11 @@ void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc)
 
 void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd)
 {
+       /* cleanup first to allow concurrent access to device's
+        * stats via debugfs to complete safely
+        */
+       lprocfs_obd_cleanup(obd);
+
         if (obd->obd_svc_procroot)
                 lprocfs_remove(&obd->obd_svc_procroot);