*/
static int osp_disconnect(struct osp_device *d)
{
+ struct obd_device *obd = d->opd_obd;
struct obd_import *imp;
int rc = 0;
- imp = d->opd_obd->u.cli.cl_import;
+ imp = obd->u.cli.cl_import;
/* Mark import deactivated now, so we don't try to reconnect if any
* of the cleanup RPCs fails (e.g. ldlm cancel, etc). We don't
rc = ptlrpc_disconnect_import(imp, 0);
if (rc != 0)
- CERROR("%s: can't disconnect: rc = %d\n",
- d->opd_obd->obd_name, rc);
+ CERROR("%s: can't disconnect: rc = %d\n", obd->obd_name, rc);
ptlrpc_invalidate_import(imp);
case LCFG_PRE_CLEANUP:
rc = osp_disconnect(d);
osp_update_fini(env, d);
+ if (obd->obd_namespace != NULL)
+ ldlm_namespace_free_prior(obd->obd_namespace, NULL, 1);
break;
case LCFG_CLEANUP:
lu_dev_del_linkage(dev->ld_site, dev);
if (rc != 0)
GOTO(out, rc);
- CDEBUG(D_CACHE, "%s: id: used %lu, processed %lu\n",
+ CDEBUG(D_CACHE, "%s: id: used %lu, processed "LPU64"\n",
d->opd_obd->obd_name, id, d->opd_syn_last_processed_id);
/* wait till all-in-line are processed */
atomic_inc(&d->opd_syn_barrier);
CDEBUG(D_CACHE, "%s: %u in flight\n", d->opd_obd->obd_name,
- d->opd_syn_rpc_in_flight);
+ atomic_read(&d->opd_syn_rpc_in_flight));
/* wait till all-in-flight are replied, so executed by the target */
/* XXX: this is used by LFSCK at the moment, which doesn't require
* all the changes to be committed, but in general it'd be
* better to wait till commit */
- while (d->opd_syn_rpc_in_flight > 0) {
+ while (atomic_read(&d->opd_syn_rpc_in_flight) > 0) {
- old = d->opd_syn_rpc_in_flight;
+ old = atomic_read(&d->opd_syn_rpc_in_flight);
expire = cfs_time_shift(obd_timeout);
lwi = LWI_TIMEOUT(expire - cfs_time_current(),
osp_sync_timeout, d);
l_wait_event(d->opd_syn_barrier_waitq,
- d->opd_syn_rpc_in_flight == 0, &lwi);
+ atomic_read(&d->opd_syn_rpc_in_flight) == 0,
+ &lwi);
- if (d->opd_syn_rpc_in_flight == 0)
+ if (atomic_read(&d->opd_syn_rpc_in_flight) == 0)
break;
- if (d->opd_syn_rpc_in_flight != old) {
+ if (atomic_read(&d->opd_syn_rpc_in_flight) != old) {
/* some progress have been made */
continue;
}
*ocd = *data;
imp->imp_connect_flags_orig = ocd->ocd_connect_flags;
+ imp->imp_connect_flags2_orig = ocd->ocd_connect_flags2;
ocd->ocd_version = LUSTRE_VERSION_CODE;
ocd->ocd_index = data->ocd_index;
- imp->imp_connect_flags_orig = ocd->ocd_connect_flags;
rc = ptlrpc_connect_import(imp);
if (rc) {
enum obd_import_event event)
{
struct osp_device *d = lu2osp_dev(obd->obd_lu_dev);
+ int rc;
switch (event) {
case IMP_EVENT_DISCON:
case IMP_EVENT_INACTIVE:
d->opd_imp_active = 0;
d->opd_imp_connected = 0;
+ d->opd_obd->obd_inactive = 1;
if (d->opd_connect_mdt)
break;
-
if (d->opd_pre != NULL) {
- osp_pre_update_status(d, -ENODEV);
+ /* Import is invalid, we can`t get stripes so
+ * wakeup waiters */
+ rc = imp->imp_deactive ? -ESHUTDOWN : -ENODEV;
+ osp_pre_update_status(d, rc);
wake_up(&d->opd_pre_waitq);
}
d->opd_new_connection = 1;
d->opd_imp_connected = 1;
d->opd_imp_seen_connected = 1;
+ d->opd_obd->obd_inactive = 0;
if (d->opd_connect_mdt)
break;