- skip quotacheck on administratively disabled OSTs.
- introduce OBD_NOTIFY_DEACTIVATE & OBD_NOTIFY_ACTIVATE event, thus lov is now aware of
administratively enable/disable import event, and is able to udpate the 'ltd_activate'
accordingly.
Issue: LU-129
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Id3d2c9e1e035086e653ab500459912f7960976c8
Reviewed-on: http://review.whamcloud.com/351
Tested-by: Hudson
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
IMP_EVENT_INVALIDATE = 0x808003,
IMP_EVENT_ACTIVE = 0x808004,
IMP_EVENT_OCD = 0x808005,
+ IMP_EVENT_DEACTIVATE = 0x808006,
+ IMP_EVENT_ACTIVATE = 0x808007,
};
struct obd_import_conn {
OBD_NOTIFY_SYNC_NONBLOCK,
OBD_NOTIFY_SYNC,
/* Configuration event */
- OBD_NOTIFY_CONFIG
+ OBD_NOTIFY_CONFIG,
+ /* Administratively deactivate/activate event */
+ OBD_NOTIFY_DEACTIVATE,
+ OBD_NOTIFY_ACTIVATE
};
#define CONFIG_LOG 0x1 /* finished processing config log */
}
static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid,
- int activate);
+ enum obd_notify_event ev);
static int lov_notify(struct obd_device *obd, struct obd_device *watched,
enum obd_notify_event ev, void *data)
int rc = 0;
ENTRY;
- if (ev == OBD_NOTIFY_ACTIVE || ev == OBD_NOTIFY_INACTIVE) {
+ if (ev == OBD_NOTIFY_ACTIVE || ev == OBD_NOTIFY_INACTIVE ||
+ ev == OBD_NOTIFY_ACTIVATE || ev == OBD_NOTIFY_DEACTIVATE) {
LASSERT(watched);
if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) {
* observer can use the OSC normally.
*/
rc = lov_set_osc_active(obd, &watched->u.cli.cl_target_uuid,
- ev == OBD_NOTIFY_ACTIVE);
+ ev);
if (rc < 0) {
- CERROR("%sactivation of %s failed: %d\n",
- (ev == OBD_NOTIFY_ACTIVE) ? "" : "de",
+ CERROR("event(%d) of %s failed: %d\n", ev,
obd_uuid2str(&watched->u.cli.cl_target_uuid),
rc);
RETURN(rc);
* - any above 0 is lov index
*/
static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid,
- int activate)
+ enum obd_notify_event ev)
{
struct lov_obd *lov = &obd->u.lov;
struct lov_tgt_desc *tgt;
- int i = 0;
+ int i = 0, activate, active;
ENTRY;
- CDEBUG(D_INFO, "Searching in lov %p for uuid %s (activate=%d)\n",
- lov, uuid->uuid, activate);
+ CDEBUG(D_INFO, "Searching in lov %p for uuid %s event(%d)\n",
+ lov, uuid->uuid, ev);
obd_getref(obd);
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
if (i == lov->desc.ld_tgt_count)
GOTO(out, i = -EINVAL);
- if (lov->lov_tgts[i]->ltd_active == activate) {
+ if (ev == OBD_NOTIFY_DEACTIVATE || ev == OBD_NOTIFY_ACTIVATE) {
+ activate = (ev == OBD_NOTIFY_ACTIVATE) ? 1 : 0;
+
+ if (lov->lov_tgts[i]->ltd_activate == activate) {
+ CDEBUG(D_INFO, "OSC %s already %sactivate!\n",
+ uuid->uuid, activate ? "" : "de");
+ } else {
+ lov->lov_tgts[i]->ltd_activate = activate;
+ CDEBUG(D_CONFIG, "%sactivate OSC %s\n",
+ activate ? "" : "de", obd_uuid2str(uuid));
+ }
+ GOTO(out, i);
+ }
+
+ active = (ev == OBD_NOTIFY_ACTIVE) ? 1 : 0;
+
+ if (lov->lov_tgts[i]->ltd_active == active) {
CDEBUG(D_INFO, "OSC %s already %sactive!\n", uuid->uuid,
- activate ? "" : "in");
+ active ? "" : "in");
GOTO(out, i);
}
CDEBUG(D_CONFIG, "Marking OSC %s %sactive\n", obd_uuid2str(uuid),
- activate ? "" : "in");
+ active ? "" : "in");
- lov->lov_tgts[i]->ltd_active = activate;
+ lov->lov_tgts[i]->ltd_active = active;
- if (activate) {
+ if (active) {
lov->desc.ld_active_tgt_count++;
lov->lov_tgts[i]->ltd_exp->exp_obd->obd_inactive = 0;
} else {
case IMP_EVENT_OCD:
ptlrpc_import_setasync(imp, obd->obd_namespace->ns_max_unused);
break;
-
+ case IMP_EVENT_DEACTIVATE:
+ case IMP_EVENT_ACTIVATE:
+ break;
default:
CERROR("Unknown import event %x\n", event);
LBUG();
break;
case IMP_EVENT_OCD:
break;
+ case IMP_EVENT_DEACTIVATE:
+ case IMP_EVENT_ACTIVATE:
+ break;
default:
CERROR("Unknown import event %#x\n", event);
LBUG();
rc = obd_notify_observer(obd, obd, OBD_NOTIFY_OCD, NULL);
break;
}
+ case IMP_EVENT_DEACTIVATE: {
+ rc = obd_notify_observer(obd, obd, OBD_NOTIFY_DEACTIVATE, NULL);
+ break;
+ }
+ case IMP_EVENT_ACTIVATE: {
+ rc = obd_notify_observer(obd, obd, OBD_NOTIFY_ACTIVATE, NULL);
+ break;
+ }
default:
CERROR("Unknown import event %d\n", event);
LBUG();
imp->imp_deactive = 1;
spin_unlock(&imp->imp_lock);
+ obd_import_event(imp->imp_obd, imp, IMP_EVENT_DEACTIVATE);
+
ptlrpc_invalidate_import(imp);
}
spin_lock(&imp->imp_lock);
imp->imp_deactive = 0;
spin_unlock(&imp->imp_lock);
+ obd_import_event(imp->imp_obd, imp, IMP_EVENT_ACTIVATE);
rc = ptlrpc_recover_import_no_retry(imp, new_uuid);
if (!lov->lov_tgts[i])
continue;
+ /* Skip quota check on the administratively disabled OSTs. */
+ if (!lov->lov_tgts[i]->ltd_activate) {
+ CWARN("lov idx %d was administratively disabled\n", i);
+ continue;
+ }
+
if (!lov->lov_tgts[i]->ltd_active) {
CERROR("lov idx %d inactive\n", i);
rc = -EIO;
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
int err;
- if (!lov->lov_tgts[i])
+ if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_activate)
continue;
err = obd_quotacheck(lov->lov_tgts[i]->ltd_exp, oqctl);
struct ptlrpc_request *req;
struct obd_quotactl *oqc;
- if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) {
- if (oqctl->qc_cmd == Q_GETOQUOTA) {
+ if (!lov->lov_tgts[i])
+ continue;
+
+ if (!lov->lov_tgts[i]->ltd_active) {
+ /* Skip Q_GETOQUOTA on administratively disabled OSTs.
+ */
+ if (oqctl->qc_cmd == Q_GETOQUOTA &&
+ lov->lov_tgts[i]->ltd_activate) {
CERROR("ost %d is inactive\n", i);
rc = -EIO;
} else {
echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
done
+ # quotacheck should not fail immediately after deactivate
+ [ -n "$ENABLE_QUOTA" ] && { $LFS quotacheck -ug $MOUNT || error "quotacheck has failed" ; }
+
# test new client starts deactivated
umount_client $MOUNT || return 200
mount_client $MOUNT
echo "New client success: got $RESULT"
fi
+ # quotacheck should not fail after umount/mount operation
+ [ -n "$ENABLE_QUOTA" ] && { $LFS quotacheck -ug $MOUNT || error "quotacheck has failed" ; }
+
# make sure it reactivates
set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6