X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flov%2Flov_obd.c;h=7972d62908253bcdabdd376d59bcf58d4a97b380;hb=6ae92a7f1bd94c8182c1cc05fad8d3c394c0d959;hp=c8efb94401031dac7e9bb487b2f63960a5e08f15;hpb=1d116c8ff68fc784141b647b790e4b4861460797;p=fs%2Flustre-release.git diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index c8efb94..7972d62 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -258,20 +258,20 @@ static int lov_connect(const struct lu_env *env, static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) { - struct lov_obd *lov = &obd->u.lov; - struct obd_device *osc_obd; - int rc; - ENTRY; + struct lov_obd *lov = &obd->u.lov; + struct obd_device *osc_obd; + int rc; + ENTRY; - osc_obd = class_exp2obd(tgt->ltd_exp); - CDEBUG(D_CONFIG, "%s: disconnecting target %s\n", - obd->obd_name, osc_obd->obd_name); + osc_obd = class_exp2obd(tgt->ltd_exp); + CDEBUG(D_CONFIG, "%s: disconnecting target %s\n", obd->obd_name, + osc_obd ? osc_obd->obd_name : ""); - if (tgt->ltd_active) { - tgt->ltd_active = 0; - lov->desc.ld_active_tgt_count--; - tgt->ltd_exp->exp_obd->obd_inactive = 1; - } + if (tgt->ltd_active) { + tgt->ltd_active = 0; + lov->desc.ld_active_tgt_count--; + tgt->ltd_exp->exp_obd->obd_inactive = 1; + } if (osc_obd) { if (lov->lov_tgts_kobj) @@ -291,17 +291,17 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) lov->targets_proc_entry); } - obd_register_observer(osc_obd, NULL); + obd_register_observer(osc_obd, NULL); - rc = obd_disconnect(tgt->ltd_exp); - if (rc) { - CERROR("Target %s disconnect error %d\n", - tgt->ltd_uuid.uuid, rc); - rc = 0; - } + rc = obd_disconnect(tgt->ltd_exp); + if (rc) { + CERROR("Target %s disconnect error %d\n", + tgt->ltd_uuid.uuid, rc); + rc = 0; + } - tgt->ltd_exp = NULL; - RETURN(0); + tgt->ltd_exp = NULL; + RETURN(0); } static int lov_disconnect(struct obd_export *exp) @@ -813,8 +813,7 @@ static int lov_cleanup(struct obd_device *obd) continue; /* Inactive targets may never have connected */ - if (lov->lov_tgts[i]->ltd_active || - atomic_read(&lov->lov_refcount)) + if (lov->lov_tgts[i]->ltd_active) /* We should never get here - these * should have been removed in the * disconnect. */ @@ -1101,46 +1100,46 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, OBD_FREE_PTR(oqctl); break; } - default: { - int set = 0; + default: { + int set = 0; - if (count == 0) - RETURN(-ENOTTY); + if (count == 0) + RETURN(-ENOTTY); - for (i = 0; i < count; i++) { - int err; - struct obd_device *osc_obd; + for (i = 0; i < count; i++) { + int err; + struct obd_device *osc_obd; - /* OST was disconnected */ - if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_exp) - continue; + /* OST was disconnected */ + if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_exp) + continue; /* ll_umount_begin() sets force on lov, pass to osc */ osc_obd = class_exp2obd(lov->lov_tgts[i]->ltd_exp); - osc_obd->obd_force = obd->obd_force; + if (osc_obd) + osc_obd->obd_force = obd->obd_force; err = obd_iocontrol(cmd, lov->lov_tgts[i]->ltd_exp, len, karg, uarg); if (err) { - if (lov->lov_tgts[i]->ltd_active) { - CDEBUG(err == -ENOTTY ? - D_IOCTL : D_WARNING, - "iocontrol OSC %s on OST " - "idx %d cmd %x: err = %d\n", - lov_uuid2str(lov, i), - i, cmd, err); - if (!rc) - rc = err; - } - } else { - set = 1; - } - } - if (!set && !rc) - rc = -EIO; - } - } + if (lov->lov_tgts[i]->ltd_active) { + CDEBUG(err == -ENOTTY ? + D_IOCTL : D_WARNING, + "iocontrol OSC %s on OST idx %d cmd %x: err = %d\n", + lov_uuid2str(lov, i), + i, cmd, err); + if (!rc) + rc = err; + } + } else { + set = 1; + } + } + if (!set && !rc) + rc = -EIO; + } + } - RETURN(rc); + RETURN(rc); } static int lov_get_info(const struct lu_env *env, struct obd_export *exp,