From 8203c0f7a043aad9d087018119e278e4279ca8bc Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Wed, 25 Aug 2021 20:03:47 +0300 Subject: [PATCH] EX-3687 osp: do force disconnect if import is not ready Send OSP_DISCONNECT only on health import. Otherwise, force local disconnect for unhealthy imports. Signed-off-by: Mikhail Pershin Change-Id: Icd9f171271f4e17a65503fcc710ad3aaa2b84e1e Reviewed-on: https://review.whamcloud.com/44753 Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/osp/osp_dev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index 8c05af9..b36842f 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -479,6 +479,11 @@ static int osp_disconnect(struct osp_device *d) * never added.) */ (void)ptlrpc_pinger_del_import(imp); + /* Send disconnect on healthy import, do force disconnect otherwise */ + spin_lock(&imp->imp_lock); + imp->imp_obd->obd_force = imp->imp_state != LUSTRE_IMP_FULL; + spin_unlock(&imp->imp_lock); + rc = ptlrpc_disconnect_import(imp, 0); if (rc != 0) CERROR("%s: can't disconnect: rc = %d\n", obd->obd_name, rc); -- 1.8.3.1