diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 653995da4fc8174c4973229f8d957618196f378b..7da83383bfed5ced6f1722e31da8f66af90cef76 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -232,6 +232,8 @@ static int config_log_add(char *logname, struct config_llog_instance *cfg, RETURN(rc); } +DECLARE_MUTEX(llog_process_lock); + /* Stop watching for updates on this log. */ static int config_log_end(char *logname, struct config_llog_instance *cfg) { @@ -245,7 +247,10 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) /* drop the ref from the find */ config_log_put(cld); + down(&llog_process_lock); cld->cld_stopping = 1; + up(&llog_process_lock); + /* drop the start ref */ config_log_put(cld); CDEBUG(D_MGC, "end config log %s (%d)\n", logname ? logname : "client", @@ -1081,8 +1086,6 @@ out: RETURN(rc); } -DECLARE_MUTEX(llog_process_lock); - /* Get a config log from the MGS and process it. This func is called for both clients and servers. */ static int mgc_process_log(struct obd_device *mgc, @@ -1101,8 +1104,17 @@ static int mgc_process_log(struct obd_device *mgc, CERROR("Missing cld, aborting log update\n"); RETURN(-EINVAL); } - if (cld->cld_stopping) + + /* I don't want mutliple processes running process_log at once -- + sounds like badness. It actually might be fine, as long as + we're not trying to update from the same log + simultaneously (in which case we should use a per-log sem.) */ + down(&llog_process_lock); + + if (cld->cld_stopping) { + up(&llog_process_lock); RETURN(0); + } OBD_FAIL_TIMEOUT(OBD_FAIL_MGC_PAUSE_PROCESS_LOG, 20); @@ -1114,15 +1126,10 @@ static int mgc_process_log(struct obd_device *mgc, ctxt = llog_get_context(mgc, LLOG_CONFIG_REPL_CTXT); if (!ctxt) { CERROR("missing llog context\n"); + up(&llog_process_lock); RETURN(-EINVAL); } - /* I don't want mutliple processes running process_log at once -- - sounds like badness. It actually might be fine, as long as - we're not trying to update from the same log - simultaneously (in which case we should use a per-log sem.) */ - down(&llog_process_lock); - /* Get the cfg lock on the llog */ rcl = mgc_enqueue(mgc->u.cli.cl_mgc_mgsexp, NULL, LDLM_PLAIN, NULL, LCK_CR, &flags, NULL, NULL, NULL,