From 9f0ce80e7c83eb584306709a34410a15fcea3bde Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Fri, 11 Apr 2025 16:02:43 +0000 Subject: [PATCH] LU-18921 ldlm: make client_obd_cleanup return void client_obd_cleanup() can never fail and it always returns 0. Make the function return void instead and fix all of the callers. Test-Parameters: trivial Fixes: 911b6167a37c ("LU-3810 obd: Cleanup client import if client_obd_setup fail") Signed-off-by: Timothy Day Change-Id: I5a5987b4fafb712c35943620235620c6370a9f76 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58761 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Vandana Rungta Reviewed-by: Shaun Tancheff Reviewed-by: James Simmons Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/include/lustre_net.h | 2 +- lustre/ldlm/ldlm_lib.c | 4 ++-- lustre/mgc/mgc_request.c | 6 ++---- lustre/osc/osc_request.c | 7 ++----- lustre/osp/lwp_dev.c | 12 ++++-------- lustre/osp/osp_dev.c | 6 ++---- 6 files changed, 13 insertions(+), 24 deletions(-) diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 40fa065..d4fd6c8 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -2589,7 +2589,7 @@ ptlrpc_req2svc(struct ptlrpc_request *req) * @{ */ int client_obd_setup(struct obd_device *obd, struct lustre_cfg *lcfg); -int client_obd_cleanup(struct obd_device *obd); +void client_obd_cleanup(struct obd_device *obd); int client_connect_import(const struct lu_env *env, struct obd_export **exp, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *ocd, diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 80f5699..13528ca 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -567,7 +567,7 @@ err: } EXPORT_SYMBOL(client_obd_setup); -int client_obd_cleanup(struct obd_device *obd) +void client_obd_cleanup(struct obd_device *obd) { struct client_obd *cli = &obd->u.cli; @@ -585,7 +585,7 @@ int client_obd_cleanup(struct obd_device *obd) BITS_TO_LONGS(OBD_MAX_RIF_MAX) * sizeof(long)); cli->cl_mod_tag_bitmap = NULL; - RETURN(0); + EXIT; } EXPORT_SYMBOL(client_obd_cleanup); diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 672f78d..065ca67 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -818,8 +818,6 @@ static int mgc_precleanup(struct obd_device *obd) static int mgc_cleanup(struct obd_device *obd) { - int rc; - ENTRY; /* COMPAT_146 - old config logs may have added profiles secretly */ @@ -830,8 +828,8 @@ static int mgc_cleanup(struct obd_device *obd) lprocfs_obd_cleanup(obd); ptlrpcd_decref(); - rc = client_obd_cleanup(obd); - RETURN(rc); + client_obd_cleanup(obd); + RETURN(0); } static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 7789edc..c5a1daf 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -4036,7 +4036,6 @@ static int osc_precleanup(struct obd_device *obd) int osc_cleanup_common(struct obd_device *obd) { struct client_obd *cli = &obd->u.cli; - int rc; ENTRY; @@ -4057,11 +4056,9 @@ int osc_cleanup_common(struct obd_device *obd) /* free memory of osc quota cache */ osc_quota_cleanup(obd); - - rc = client_obd_cleanup(obd); - + client_obd_cleanup(obd); ptlrpcd_decref(); - RETURN(rc); + RETURN(0); } EXPORT_SYMBOL(osc_cleanup_common); diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index 8f39d87..4c9cbbc 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -369,9 +369,9 @@ static struct lu_device *lwp_device_alloc(const struct lu_env *env, static struct lu_device *lwp_device_fini(const struct lu_env *env, struct lu_device *ludev) { - struct lwp_device *m = lu2lwp_dev(ludev); - struct task_struct *task = NULL; - int rc; + struct lwp_device *m = lu2lwp_dev(ludev); + struct task_struct *task = NULL; + ENTRY; task = xchg(&m->lpd_notify_task, NULL); @@ -384,13 +384,9 @@ static struct lu_device *lwp_device_fini(const struct lu_env *env, class_disconnect(m->lpd_exp); LASSERT(m->lpd_obd); - rc = client_obd_cleanup(m->lpd_obd); - LASSERTF(rc == 0, "error %d\n", rc); - + client_obd_cleanup(m->lpd_obd); 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 177f110..156ca64 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -1370,7 +1370,6 @@ static struct lu_device *osp_device_fini(const struct lu_env *env, struct lu_device *ld) { struct osp_device *osp = lu2osp_dev(ld); - int rc; ENTRY; @@ -1392,10 +1391,9 @@ static struct lu_device *osp_device_fini(const struct lu_env *env, * the obd devices are already gone. */ osp_tunables_fini(osp); - rc = client_obd_cleanup(osp->opd_obd); + client_obd_cleanup(osp->opd_obd); ptlrpcd_decref(); - - RETURN(rc != 0 ? ERR_PTR(rc) : NULL); + RETURN(NULL); } /** -- 1.8.3.1