X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqmt_dev.c;h=f785ac969696401c9e67dda5ed6eb11a1d52f4d4;hb=1f828c4699462936f75f18d8d8e8f33720e448fd;hp=346d961fa907a3d83b0068c8b0d9ed9979cfd857;hpb=2b294992edce5af7b79d4300ed3aa1ea6a8db850;p=fs%2Flustre-release.git diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c index 346d961..f785ac9 100644 --- a/lustre/quota/qmt_dev.c +++ b/lustre/quota/qmt_dev.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012, 2014, Intel Corporation. + * Copyright (c) 2012, 2017, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -107,7 +107,13 @@ static struct lu_device *qmt_device_fini(const struct lu_env *env, } /* stop rebalance thread */ - qmt_stop_reba_thread(qmt); + if (!qmt->qmt_child->dd_rdonly) + qmt_stop_reba_thread(qmt); + + if (qmt->qmt_root) { + dt_object_put(env, qmt->qmt_root); + qmt->qmt_root = NULL; + } /* disconnect from OSD */ if (qmt->qmt_child_exp != NULL) { @@ -240,15 +246,15 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt, GOTO(out, rc); /* set up and start rebalance thread */ - thread_set_flags(&qmt->qmt_reba_thread, SVC_STOPPED); - init_waitqueue_head(&qmt->qmt_reba_thread.t_ctl_waitq); 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); + if (!qmt->qmt_child->dd_rdonly) { + 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 @@ -256,9 +262,12 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt, type = class_search_type(LUSTRE_QMT_NAME); LASSERT(type != NULL); + /* put reference taken by class_search_type */ + kobject_put(&type->typ_kobj); + /* register proc directory associated with this qmt */ - qmt->qmt_proc = lprocfs_seq_register(qmt->qmt_svname, type->typ_procroot, - NULL, NULL); + qmt->qmt_proc = lprocfs_register(qmt->qmt_svname, type->typ_procroot, + NULL, NULL); if (IS_ERR(qmt->qmt_proc)) { rc = PTR_ERR(qmt->qmt_proc); CERROR("%s: failed to create qmt proc entry (%d)\n", @@ -270,6 +279,7 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt, rc = qmt_pool_init(env, qmt); if (rc) GOTO(out, rc); + EXIT; out: if (rc) @@ -413,10 +423,14 @@ static int qmt_device_obd_disconnect(struct obd_export *exp) /* * obd device operations associated with the master target. */ -struct obd_ops qmt_obd_ops = { +static const struct obd_ops qmt_obd_ops = { .o_owner = THIS_MODULE, .o_connect = qmt_device_obd_connect, .o_disconnect = qmt_device_obd_disconnect, + .o_pool_new = qmt_pool_new, + .o_pool_rem = qmt_pool_rem, + .o_pool_add = qmt_pool_add, + .o_pool_del = qmt_pool_del, }; /* @@ -449,10 +463,9 @@ static int qmt_device_prepare(const struct lu_env *env, RETURN(rc); } + qmt->qmt_root = qmt_root; /* initialize on-disk indexes associated with each pool */ - rc = qmt_pool_prepare(env, qmt, qmt_root); - - lu_object_put(env, &qmt_root->do_lu); + rc = qmt_pool_prepare(env, qmt, qmt_root, NULL); RETURN(rc); }