LASSERT(lsi->lsi_lmd);
if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)) {
struct config_llog_data *recover_cld;
- *strrchr(seclogname, '-') = 0;
+ ptr = strrchr(seclogname, '-');
+ if (ptr != NULL) {
+ *ptr = 0;
+ }
+ else {
+ CERROR("sptlrpc log name not correct: %s", seclogname);
+ config_log_put(cld);
+ RETURN(-EINVAL);
+ }
recover_cld = config_recover_log_add(obd, seclogname, cfg, sb);
if (IS_ERR(recover_cld))
GOTO(out_err3, rc = PTR_ERR(recover_cld));
#define RQ_LATER 0x4
#define RQ_STOP 0x8
static int rq_state = 0;
-static cfs_waitq_t rq_waitq;
+static wait_queue_head_t rq_waitq;
static DECLARE_COMPLETION(rq_exit);
static void do_requeue(struct config_llog_data *cld)
{
+ int rc = 0;
ENTRY;
LASSERT(cfs_atomic_read(&cld->cld_refcount) > 0);
export which is being disconnected. Take the client
semaphore to make the check non-racy. */
down_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem);
- if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
- CDEBUG(D_MGC, "updating log %s\n", cld->cld_logname);
- mgc_process_log(cld->cld_mgcexp->exp_obd, cld);
- } else {
- CDEBUG(D_MGC, "disconnecting, won't update log %s\n",
- cld->cld_logname);
- }
+ if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
+ CDEBUG(D_MGC, "updating log %s\n", cld->cld_logname);
+ rc = mgc_process_log(cld->cld_mgcexp->exp_obd, cld);
+ if (rc && rc != -ENOENT)
+ CERROR("failed processing log: %d\n", rc);
+ } else {
+ CDEBUG(D_MGC, "disconnecting, won't update log %s\n",
+ cld->cld_logname);
+ }
up_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem);
EXIT;
rq_state &= ~(RQ_NOW | RQ_LATER);
spin_unlock(&config_list_lock);
- /* 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. */
- to = MGC_TIMEOUT_MIN_SECONDS * CFS_HZ;
- to += rand * CFS_HZ / 100; /* rand is centi-seconds */
- lwi = LWI_TIMEOUT(to, NULL, NULL);
- l_wait_event(rq_waitq, rq_state & RQ_STOP, &lwi);
+ /* 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. */
+ to = MGC_TIMEOUT_MIN_SECONDS * HZ;
+ to += rand * HZ / 100; /* rand is centi-seconds */
+ lwi = LWI_TIMEOUT(to, NULL, NULL);
+ l_wait_event(rq_waitq, rq_state & RQ_STOP, &lwi);
/*
* iterate & processing through the list. for each cld, process
} else {
rq_state |= RQ_NOW;
spin_unlock(&config_list_lock);
- cfs_waitq_signal(&rq_waitq);
+ wake_up(&rq_waitq);
}
EXIT;
}
rq_state |= RQ_STOP;
spin_unlock(&config_list_lock);
if (running) {
- cfs_waitq_signal(&rq_waitq);
+ wake_up(&rq_waitq);
wait_for_completion(&rq_exit);
}
}
static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
- struct lprocfs_static_vars lvars;
- int rc;
- ENTRY;
+ struct lprocfs_static_vars lvars;
+ int rc;
+ ENTRY;
- ptlrpcd_addref();
+ rc = ptlrpcd_addref();
+ if (rc < 0)
+ RETURN(rc);
- rc = client_obd_setup(obd, lcfg);
- if (rc)
- GOTO(err_decref, rc);
+ rc = client_obd_setup(obd, lcfg);
+ if (rc)
+ GOTO(err_decref, rc);
rc = mgc_llog_init(NULL, obd);
- if (rc) {
- CERROR("failed to setup llogging subsystems\n");
- GOTO(err_cleanup, rc);
- }
+ if (rc) {
+ CERROR("failed to setup llogging subsystems\n");
+ GOTO(err_cleanup, rc);
+ }
- lprocfs_mgc_init_vars(&lvars);
- lprocfs_obd_setup(obd, lvars.obd_vars);
- sptlrpc_lprocfs_cliobd_attach(obd);
+ lprocfs_mgc_init_vars(&lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
+ sptlrpc_lprocfs_cliobd_attach(obd);
- if (cfs_atomic_inc_return(&mgc_count) == 1) {
+ if (cfs_atomic_inc_return(&mgc_count) == 1) {
rq_state = 0;
- cfs_waitq_init(&rq_waitq);
+ init_waitqueue_head(&rq_waitq);
/* start requeue thread */
rc = PTR_ERR(kthread_run(mgc_requeue_thread, NULL,
}
/* rc is the task_struct pointer of mgc_requeue_thread. */
rc = 0;
- }
+ }
- RETURN(rc);
+ RETURN(rc);
err_cleanup:
- client_obd_cleanup(obd);
+ client_obd_cleanup(obd);
err_decref:
- ptlrpcd_decref();
- RETURN(rc);
+ ptlrpcd_decref();
+ RETURN(rc);
}
/* based on ll_mdc_blocking_ast */
spin_lock(&config_list_lock);
rq_state |= RQ_NOW;
spin_unlock(&config_list_lock);
- cfs_waitq_signal(&rq_waitq);
+ wake_up(&rq_waitq);
/* TODO: Help the MGS rebuild nidtbl. -jay */
}