From d9c595b530c5bc5f112698151bd1e9f4d74080cb Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Tue, 28 Nov 2017 10:15:16 -0500 Subject: [PATCH] LU-10224 obd: free obd_svc_stats when all users are gone 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. Lustre-change: https://review.whamcloud.com/30249 Lustre-commit: ffc843a0aacd78495b1cff51344aaee3e32fc2de Signed-off-by: Bruno Faccini Change-Id: Iea4f5b0486779c1721c90f32538af1a723f76a79 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/31197 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond --- lustre/mdc/mdc_request.c | 2 -- lustre/osc/osc_request.c | 1 - lustre/osp/lwp_dev.c | 1 - lustre/osp/osp_dev.c | 2 -- lustre/ptlrpc/lproc_ptlrpc.c | 5 +++++ 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index b2758ca..1152829 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -2523,7 +2523,6 @@ err_mdc_cleanup: err_ptlrpcd_decref: if (rc) ptlrpcd_decref(); - return rc; } @@ -2559,7 +2558,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); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 6038107..908b5e3 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2952,7 +2952,6 @@ static int osc_precleanup(struct obd_device *obd) obd_cleanup_client_import(obd); ptlrpc_lprocfs_unregister_obd(obd); - lprocfs_obd_cleanup(obd); RETURN(0); } diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index d966358..3863bc3 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -375,7 +375,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); diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index d7848e2..27a614c 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -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; diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 9aa7ed5..ed2058a 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -1214,6 +1214,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); -- 1.8.3.1