From: James Simmons Date: Thu, 11 Jul 2019 01:08:48 +0000 (-0400) Subject: LU-10756 osp: properly order sysfs registration X-Git-Tag: 2.12.57~29 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=2f16681d68650c0c834c9af3e05c8ed98f481d1d LU-10756 osp: properly order sysfs registration When generating udev events for import states I found that the order of setting up the sysfs tree for osp was important. Setup the osp obd device sysfs tree before lwp sysfs device. Always call client_obd_cleanup() first on shutdown. Change-Id: I29257f3e91f10f8266509b535e36cc8b62ce2362 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/35464 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin --- diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index f6277d3..829555e 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -260,18 +260,19 @@ static int lwp_init0(const struct lu_env *env, struct lwp_device *lwp, RETURN(rc); } - rc = lwp_setup(env, lwp, lustre_cfg_string(cfg, 1)); + rc = lprocfs_obd_setup(lwp->lpd_obd, true); if (rc) { - CERROR("%s: setup lwp failed. %d\n", + CERROR("%s: lprocfs_obd_setup failed. %d\n", lwp->lpd_obd->obd_name, rc); ptlrpcd_decref(); RETURN(rc); } - rc = lprocfs_obd_setup(lwp->lpd_obd, true); + rc = lwp_setup(env, lwp, lustre_cfg_string(cfg, 1)); if (rc) { - CERROR("%s: lprocfs_obd_setup failed. %d\n", + CERROR("%s: setup lwp failed. %d\n", lwp->lpd_obd->obd_name, rc); + lprocfs_obd_cleanup(lwp->lpd_obd); ptlrpcd_decref(); RETURN(rc); } @@ -380,11 +381,11 @@ static struct lu_device *lwp_device_fini(const struct lu_env *env, class_disconnect(m->lpd_exp); LASSERT(m->lpd_obd); - ptlrpc_lprocfs_unregister_obd(m->lpd_obd); - rc = client_obd_cleanup(m->lpd_obd); LASSERTF(rc == 0, "error %d\n", rc); + ptlrpc_lprocfs_unregister_obd(m->lpd_obd); + ptlrpcd_decref(); RETURN(NULL); diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index f45cd74..dc3249b 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -1339,7 +1339,6 @@ static struct lu_device *osp_device_fini(const struct lu_env *env, } LASSERT(osp->opd_obd); - osp_tunables_fini(osp); rc = client_obd_cleanup(osp->opd_obd); if (rc != 0) { @@ -1347,6 +1346,8 @@ static struct lu_device *osp_device_fini(const struct lu_env *env, RETURN(ERR_PTR(rc)); } + osp_tunables_fini(osp); + ptlrpcd_decref(); RETURN(NULL);