strcpy(cld->cld_logname, logname);
if (cfg)
cld->cld_cfg = *cfg;
+ cfs_mutex_init(&cld->cld_lock);
cld->cld_cfg.cfg_last_idx = 0;
cld->cld_cfg.cfg_flags = 0;
cld->cld_cfg.cfg_sb = sb;
if (IS_ERR(cld))
RETURN(PTR_ERR(cld));
- cfs_down(&llog_process_lock);
+ cfs_mutex_lock(&cld->cld_lock);
/*
* if cld_stopping is set, it means we didn't start the log thus
* not owning the start ref. this can happen after previous umount:
* calling start_log.
*/
if (unlikely(cld->cld_stopping)) {
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
/* drop the ref from the find */
config_log_put(cld);
RETURN(rc);
}
cld->cld_stopping = 1;
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
cfs_spin_lock(&config_list_lock);
cld_sptlrpc = cld->cld_sptlrpc;
/* Always wait a few seconds to allow the server who
caused the lock revocation to finish its setup, plus some
random so everyone doesn't try to reconnect at once. */
- lwi_now = LWI_TIMEOUT(3 * CFS_HZ + (ll_rand() & 0xff) * \
+ lwi_now = LWI_TIMEOUT(3 * CFS_HZ + (cfs_rand() & 0xff) * \
(CFS_HZ / 100),
NULL, NULL);
l_wait_event(rq_waitq, rq_state & RQ_STOP, &lwi_now);
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.) */
- cfs_down(&llog_process_lock);
+ cfs_mutex_lock(&cld->cld_lock);
if (cld->cld_stopping) {
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
RETURN(0);
}
ctxt = llog_get_context(mgc, LLOG_CONFIG_REPL_CTXT);
if (!ctxt) {
CERROR("missing llog context\n");
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
RETURN(-EINVAL);
}
CDEBUG(D_MGC, "%s: configuration from log '%s' %sed (%d).\n",
mgc->obd_name, cld->cld_logname, rc ? "fail" : "succeed", rc);
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
RETURN(rc);
}