/* Obd flag bits */
enum {
OBDF_ATTACHED, /* finished attach */
+ OBDF_SET_UP, /* finished setup */
OBDF_NUM_FLAGS,
};
/* bitfield modification is protected by obd_dev_lock */
DECLARE_BITMAP(obd_flags, OBDF_NUM_FLAGS);
unsigned long
- obd_set_up:1, /* finished setup */
obd_recovering:1, /* there are recoverable clients */
obd_abort_recovery:1, /* abort client and MDT recovery */
obd_abort_mdt_recovery:1, /* abort recovery between MDTs */
if (rc) \
return rc; \
\
- if (!(obd)->obd_set_up || (obd)->obd_stopping) { \
+ if (!test_bit(OBDF_SET_UP, (obd)->obd_flags) || \
+ (obd)->obd_stopping) { \
CERROR("Device %d not setup\n", \
(obd)->obd_minor); \
RETURN(-ENODEV); \
return;
}
- if (obd->obd_set_up && obd->obd_type->typ_dt_ops->o_import_event)
+ if (test_bit(OBDF_SET_UP, obd->obd_flags) &&
+ obd->obd_type->typ_dt_ops->o_import_event)
obd->obd_type->typ_dt_ops->o_import_event(obd, imp, event);
EXIT;
if (rc)
return rc;
- if (!obd->obd_set_up) {
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags)) {
CDEBUG(D_HA, "obd %s not set up\n", obd->obd_name);
RETURN(-EINVAL);
}
CERROR("cleaned up obd\n");
RETURN(-EOPNOTSUPP);
}
- if (!obd->obd_set_up || obd->obd_stopping)
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags) || obd->obd_stopping)
RETURN(0);
if (!obd->obd_type->typ_dt_ops->o_health_check)
RETURN(0);
/* disk obd */
tgt = class_name2obd(lustre_cfg_string(lcfg, 1));
- if (!tgt || !test_bit(OBDF_ATTACHED, tgt->obd_flags) || !tgt->obd_set_up) {
+ if (!tgt || !test_bit(OBDF_ATTACHED, tgt->obd_flags) ||
+ !test_bit(OBDF_SET_UP, tgt->obd_flags)) {
CERROR("target device not attached or not set up (%s)\n",
lustre_cfg_string(lcfg, 1));
RETURN(-EINVAL);
atomic_inc(&target->obd_conn_inprogress);
- if (target->obd_stopping || !target->obd_set_up) {
+ if (target->obd_stopping || !test_bit(OBDF_SET_UP, target->obd_flags)) {
deuuidify(str, NULL, &target_start, &target_len);
LCONSOLE_INFO("%.*s: Not available for connect from %s (%s)\n",
target_len, target_start,
ENTRY;
if (!strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME) &&
- watched->obd_set_up && !watched->obd_stopping) {
+ test_bit(OBDF_SET_UP, watched->obd_flags) &&
+ !watched->obd_stopping) {
cli = &watched->u.cli;
lco = owner;
flags = cli->cl_import->imp_connect_data.ocd_connect_flags;
CERROR("unexpected notification from %s %s"
"(setup:%d,stopping:%d)!\n",
watched->obd_type->typ_name,
- watched->obd_name, watched->obd_set_up,
+ watched->obd_name,
+ test_bit(OBDF_SET_UP, watched->obd_flags),
watched->obd_stopping);
result = -EINVAL;
}
mdc_obd->obd_name, mdc_obd->obd_uuid.uuid,
tgt->ltd_uuid.uuid, obd->obd_uuid.uuid);
- if (!mdc_obd->obd_set_up) {
+ if (!test_bit(OBDF_SET_UP, mdc_obd->obd_flags)) {
CERROR("target %s is not set up\n", tgt->ltd_uuid.uuid);
RETURN(-EINVAL);
}
struct lod_tgt_desc *tgt;
int rc = 1;
- if (!obd->obd_set_up || obd->obd_stopping)
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags) || obd->obd_stopping)
RETURN(-EAGAIN);
d = lu2lod_dev(obd->obd_lu_dev);
LASSERT(tgt != NULL);
LASSERT(tgt->ltd_obd != NULL);
- if (!tgt->ltd_obd->obd_set_up) {
+ if (!test_bit(OBDF_SET_UP, tgt->ltd_obd->obd_flags)) {
CERROR("Target %s not set up\n", obd_uuid2str(&tgt->ltd_uuid));
RETURN(-EINVAL);
}
tgt_uuid = &lov->lov_tgts[index]->ltd_uuid;
tgt_obd = lov->lov_tgts[index]->ltd_obd;
- if (!tgt_obd->obd_set_up) {
+ if (!test_bit(OBDF_SET_UP, tgt_obd->obd_flags)) {
rc = -EINVAL;
CERROR("%s: target not set up: rc = %d\n",
obd_uuid2str(tgt_uuid), rc);
struct obd_device *obd = exp->exp_obd;
struct mdd_device *mdd;
- if (!obd->obd_set_up || obd->obd_stopping)
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags) || obd->obd_stopping)
RETURN(-EAGAIN);
mdd = lu2mdd_dev(obd->obd_lu_dev);
struct mdd_device *mdd;
int rc;
- if (!obd->obd_set_up || obd->obd_stopping)
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags) || obd->obd_stopping)
RETURN(-EAGAIN);
mdd = lu2mdd_dev(obd->obd_lu_dev);
status = "ST";
else if (obd->obd_inactive)
status = "IN";
- else if (obd->obd_set_up)
+ else if (test_bit(OBDF_SET_UP, obd->obd_flags))
status = "UP";
else if (test_bit(OBDF_ATTACHED, obd->obd_flags))
status = "AT";
}
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
- if (!obd->obd_set_up || obd->obd_stopping) {
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags) || obd->obd_stopping) {
rc = -EINVAL;
CERROR("obdclass: device %d not set up: rc = %d\n",
data->ioc_dev, rc);
obd_device_lock();
obd_device_for_each(dev_no, obd) {
- if (obd->obd_set_up == 0 || obd->obd_stopping)
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags) || obd->obd_stopping)
continue;
/* only notify mdc, osc, osp, lwp, mdt, ost
status = "ST";
else if (obd->obd_inactive)
status = "IN";
- else if (obd->obd_set_up)
+ else if (test_bit(OBDF_SET_UP, obd->obd_flags))
status = "UP";
else if (test_bit(OBDF_ATTACHED, obd->obd_flags))
status = "AT";
* in error case while obd is starting up.
*/
LASSERTF(obd->obd_starting == 1 ||
- obd->obd_stopping == 1 || obd->obd_set_up == 0,
+ obd->obd_stopping == 1 ||
+ !test_bit(OBDF_SET_UP, obd->obd_flags),
"wrong obd state: %d/%d/%d\n", !!obd->obd_starting,
- !!obd->obd_stopping, !!obd->obd_set_up);
+ !!obd->obd_stopping, test_bit(OBDF_SET_UP, obd->obd_flags));
/* cleanup the llog ctxt here */
if (ctxt->loc_logops->lop_cleanup)
RETURN(-ENODEV);
}
- if (obd->obd_set_up) {
+ if (test_bit(OBDF_SET_UP, obd->obd_flags)) {
CERROR("Device %d already setup (type %s)\n",
obd->obd_minor, obd->obd_type->typ_name);
RETURN(-EEXIST);
RETURN(-EEXIST);
}
/*
- * just leave this on forever. I can't use obd_set_up here because
+ * just leave this on forever. I can't use OBDF_SET_UP here because
* other fns check that status, and we're not actually set up yet.
*/
obd->obd_starting = 1;
GOTO(err_uuid_hash, err);
#endif /* ! HAVE_SERVER_SUPPORT */
- obd->obd_set_up = 1;
+ set_bit(OBDF_SET_UP, obd->obd_flags);
spin_lock(&obd->obd_dev_lock);
/* cleanup drops this */
{
ENTRY;
- if (obd->obd_set_up) {
+ if (test_bit(OBDF_SET_UP, obd->obd_flags)) {
CERROR("OBD device %d still set up\n", obd->obd_minor);
RETURN(-EBUSY);
}
CFS_RACE(OBD_FAIL_LDLM_RECOV_CLIENTS);
- if (!obd->obd_set_up) {
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags)) {
CERROR("Device %d not setup\n", obd->obd_minor);
RETURN(-ENODEV);
}
}
#endif /* HAVE_SERVER_SUPPORT */
class_decref(obd, "setup", obd);
- obd->obd_set_up = 0;
+ clear_bit(OBDF_SET_UP, obd->obd_flags);
RETURN(0);
}
obd_device_lock();
obd_device_for_each_cond(dev_no, obd, test_bit(OBDF_ATTACHED, obd->obd_flags) &&
- obd->obd_set_up && !obd->obd_stopping &&
+ test_bit(OBDF_SET_UP, obd->obd_flags) && !obd->obd_stopping &&
!obd->obd_read_only) {
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
status = "ST";
else if (obd->obd_inactive)
status = "IN";
- else if (obd->obd_set_up)
+ else if (test_bit(OBDF_SET_UP, obd->obd_flags))
status = "UP";
else if (test_bit(OBDF_ATTACHED, obd->obd_flags))
status = "AT";
obd_device_lock();
obd_device_for_each_cond(dev_no, obd, test_bit(OBDF_ATTACHED, obd->obd_flags) &&
- obd->obd_set_up && !obd->obd_stopping) {
+ test_bit(OBDF_SET_UP, obd->obd_flags) && !obd->obd_stopping) {
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
class_incref(obd, __func__, current);
}
tgt = class_name2obd(lustre_cfg_string(lcfg, 1));
- if (!tgt || !test_bit(OBDF_ATTACHED, tgt->obd_flags) || !tgt->obd_set_up) {
+ if (!tgt || !test_bit(OBDF_ATTACHED, tgt->obd_flags) ||
+ !test_bit(OBDF_SET_UP, tgt->obd_flags)) {
CERROR("device not attached or not set up (%s)\n",
lustre_cfg_string(lcfg, 1));
RETURN(-EINVAL);
struct obd_device *obd = exp->exp_obd;
struct osp_device *osp;
- if (!obd->obd_set_up || obd->obd_stopping)
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags) || obd->obd_stopping)
RETURN(-EAGAIN);
osp = lu2osp_dev(obd->obd_lu_dev);
}
LASSERT(set != NULL);
- if (!obd->obd_set_up || obd->obd_stopping)
+ if (!test_bit(OBDF_SET_UP, obd->obd_flags) || obd->obd_stopping)
RETURN(-EAGAIN);
osp = lu2osp_dev(obd->obd_lu_dev);
RETURN(rc);
}
- if (unlikely(!obd->obd_set_up)) {
+ if (unlikely(!test_bit(OBDF_SET_UP, obd->obd_flags))) {
rc = -EINVAL;
CERROR("%s: obd not setup: rc = %d\n", obdname, rc);
RETURN(rc);
uuid = (struct obd_uuid *) uuid_obj.data;
target = class_uuid2obd(uuid);
- if (!target || target->obd_stopping || !target->obd_set_up) {
+ if (!target || target->obd_stopping ||
+ !test_bit(OBDF_SET_UP, target->obd_flags)) {
char *target_start;
int target_len;
RETURN(-ENOMEM);
lwp = class_name2obd(lwpname);
- if (lwp && lwp->obd_set_up == 1) {
+ if (lwp && test_bit(OBDF_SET_UP, lwp->obd_flags)) {
struct obd_uuid *uuid;
OBD_ALLOC_PTR(uuid);