X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqmt_dev.c;h=7c41c1a62d1ae36036af4d486f66d529efc6f3fe;hb=f26cdd1c6e1d0570f2debc13b4165a0c710f6fe5;hp=685f50f820fc7327e9e084768d13d3ad9902db10;hpb=2d61b338d9990f2098ca646ecfe818668579ca76;p=fs%2Flustre-release.git diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c index 685f50f..7c41c1a 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, 2014, 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: * @@ -66,10 +66,6 @@ * mdt_quota_init() for more details. */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif - #define DEBUG_SUBSYSTEM S_LQUOTA #include @@ -206,12 +202,17 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt, struct lu_device *ld = qmt2lu_dev(qmt); struct obd_device *obd, *mdt_obd; struct obd_type *type; + char *svname = lustre_cfg_string(cfg, 0); int rc; ENTRY; + if (svname == NULL) + RETURN(-EINVAL); + /* record who i am, it might be useful ... */ - strncpy(qmt->qmt_svname, lustre_cfg_string(cfg, 0), - sizeof(qmt->qmt_svname) - 1); + rc = strlcpy(qmt->qmt_svname, svname, sizeof(qmt->qmt_svname)); + if (rc >= sizeof(qmt->qmt_svname)) + RETURN(-E2BIG); /* look-up the obd_device associated with the qmt */ obd = class_name2obd(qmt->qmt_svname); @@ -240,9 +241,9 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt, /* 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); - cfs_spin_lock_init(&qmt->qmt_reba_lock); + 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", @@ -470,8 +471,8 @@ int qmt_glb_init(void) int rc; ENTRY; - rc = class_register_type(&qmt_obd_ops, NULL, NULL, LUSTRE_QMT_NAME, - &qmt_device_type); + rc = class_register_type(&qmt_obd_ops, NULL, true, NULL, + LUSTRE_QMT_NAME, &qmt_device_type); RETURN(rc); }