From 6b179f602aac9c6b99fc1224b1e5c4fa84d4e102 Mon Sep 17 00:00:00 2001 From: shaver Date: Thu, 10 Jul 2003 19:07:37 +0000 Subject: [PATCH] Fix logging and silly list-math bug. (Some day, some happy day, I will remember the order of the arguments to list_add.) Half-hearted attempt at disconnecting the mgmt_cli at cleanup time instead of last-deregister, to work around the lconf-socket-closure Russian Roulette situation. Will get better (reverted, in fact) when eeb lands b_multinet. --- lustre/mgmt/mgmt_cli.c | 32 ++++++++++++++++++++++++-------- lustre/mgmt/mgmt_svc.c | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/lustre/mgmt/mgmt_cli.c b/lustre/mgmt/mgmt_cli.c index fba49ab..5ee9421 100644 --- a/lustre/mgmt/mgmt_cli.c +++ b/lustre/mgmt/mgmt_cli.c @@ -23,7 +23,13 @@ */ #define EXPORT_SYMTAB -#define DEBUG_SUBSYSTEM S_MGMT + +/* + * go back to your file and define S_MGMT to be S_FILTER + * and then thank me for saving you four hours + */ + +#define DEBUG_SUBSYSTEM S_FILTER /* S_MGMT */ #include #include @@ -182,7 +188,7 @@ static int mgmtcli_register_for_events(struct obd_device *mgmt_obd, spin_lock(&mgmt_obd->obd_dev_lock); start_thread = list_empty(&mcobd->mc_registered); - list_add(&mcobd->mc_registered, ®->chain); + list_add(®->chain, &mcobd->mc_registered); spin_unlock(&mgmt_obd->obd_dev_lock); if (start_thread) @@ -213,14 +219,8 @@ static int mgmtcli_deregister_for_events(struct obd_device *mgmt_obd, break; } } - stop_thread = list_empty(&mc->mc_registered); spin_unlock(&mgmt_obd->obd_dev_lock); - if (stop_thread) { - LASSERT(found); - RETURN(mgmtcli_disconnect_from_svc(mgmt_obd)); - } - if (!found) RETURN(-ENOENT); RETURN(0); @@ -237,6 +237,22 @@ static int mgmtcli_setup(struct obd_device *obd, obd_count len, void *buf) RETURN(client_obd_setup(obd, len, buf)); } +static int mgmtcli_cleanup(struct obd_device *obd, int flags) +{ + struct mgmtcli_obd *mc = &obd->u.mgmtcli; + + if (!list_empty(&mc->mc_registered)) + RETURN(-EBUSY); + + if (mc->mc_ping_thread) { + rc = mgmtcli_disconnect_from_svc(obd); + if (rc) + RETURN(rc); + } + + RETURN(client_obd_cleanup(obd, flags); +} + static struct obd_ops mgmtcli_obd_ops = { o_owner: THIS_MODULE, o_setup: mgmtcli_setup, diff --git a/lustre/mgmt/mgmt_svc.c b/lustre/mgmt/mgmt_svc.c index 06b488b..5b1046f 100644 --- a/lustre/mgmt/mgmt_svc.c +++ b/lustre/mgmt/mgmt_svc.c @@ -23,7 +23,7 @@ */ #define EXPORT_SYMTAB -#define DEBUG_SUBSYSTEM S_MGMT +#define DEBUG_SUBSYSTEM S_FILTER #include #include -- 1.8.3.1