X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqmt_dev.c;h=959c2806077be33486629a8478b835c6174e6d67;hb=f318ba710d7dbefe9a89ed80b70f391028137498;hp=701cc161a3fbe2e0b04b89aa94f5442bfc28a444;hpb=294aa9cb666c48e02da1057c222fe5f206ce38fc;p=fs%2Flustre-release.git diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c index 701cc16..959c280 100644 --- a/lustre/quota/qmt_dev.c +++ b/lustre/quota/qmt_dev.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012 Intel, Inc. + * Copyright (c) 2012, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -45,7 +45,7 @@ * The QMT device is currently set up by the MDT and should probably be moved * to a separate target in the future. Meanwhile, the MDT forwards all quota * requests to the QMT via a list of request handlers (see struct qmt_handlers - * in lquota.h). The QMT also borrows the LDLM namespace from the MDT. + * in lustre_quota.h). The QMT also borrows the LDLM namespace from the MDT. * * To bring up a QMT device, the following steps must be completed: * @@ -101,14 +101,17 @@ static struct lu_device *qmt_device_fini(const struct lu_env *env, CDEBUG(D_QUOTA, "%s: initiating QMT shutdown\n", qmt->qmt_svname); qmt->qmt_stopping = true; + /* kill pool instances, if any */ + qmt_pool_fini(env, qmt); + /* remove qmt proc entry */ if (qmt->qmt_proc != NULL && !IS_ERR(qmt->qmt_proc)) { lprocfs_remove(&qmt->qmt_proc); qmt->qmt_proc = NULL; } - /* kill pool instances, if any */ - qmt_pool_fini(env, qmt); + /* stop rebalance thread */ + qmt_stop_reba_thread(qmt); /* disconnect from OSD */ if (qmt->qmt_child_exp != NULL) { @@ -117,12 +120,9 @@ static struct lu_device *qmt_device_fini(const struct lu_env *env, qmt->qmt_child = NULL; } - /* release reference on MDT namespace */ - if (ld->ld_obd->obd_namespace != NULL) { - ldlm_namespace_put(ld->ld_obd->obd_namespace); - ld->ld_obd->obd_namespace = NULL; - qmt->qmt_ns = NULL; - } + /* clear references to MDT namespace */ + ld->ld_obd->obd_namespace = NULL; + qmt->qmt_ns = NULL; RETURN(NULL); } @@ -227,10 +227,9 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt, if (mdt_obd == NULL) RETURN(-ENOENT); - /* grab reference on MDT namespace. kind of a hack until we have our - * own namespace & service threads */ + /* borrow MDT namespace. kind of a hack until we have our own namespace + * & service threads */ LASSERT(mdt_obd->obd_namespace != NULL); - ldlm_namespace_get(mdt_obd->obd_namespace); obd->obd_namespace = mdt_obd->obd_namespace; qmt->qmt_ns = obd->obd_namespace; @@ -239,6 +238,18 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt, if (rc) GOTO(out, rc); + /* set up and start rebalance thread */ + thread_set_flags(&qmt->qmt_reba_thread, SVC_STOPPED); + cfs_waitq_init(&qmt->qmt_reba_thread.t_ctl_waitq); + CFS_INIT_LIST_HEAD(&qmt->qmt_reba_list); + spin_lock_init(&qmt->qmt_reba_lock); + rc = qmt_start_reba_thread(qmt); + if (rc) { + CERROR("%s: failed to start rebalance thread (%d)\n", + qmt->qmt_svname, rc); + GOTO(out, rc); + } + /* at the moment there is no linkage between lu_type and obd_type, so * we lookup obd_type this way */ type = class_search_type(LUSTRE_QMT_NAME);