Whamcloud - gitweb
LU-12719 obdclass: serialize lwp list access
[fs/lustre-release.git] / lustre / quota / qmt_dev.c
index 323e56e..fe65065 100644 (file)
@@ -21,7 +21,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  * Use is subject to license terms.
  *
  * Author: Johann Lombardi <johann.lombardi@intel.com>
@@ -107,7 +107,8 @@ 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);
 
        /* disconnect from OSD */
        if (qmt->qmt_child_exp != NULL) {
@@ -240,15 +241,17 @@ 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);
+       thread_set_flags(&qmt->qmt_reba_thread, SVC_STARTING);
        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
@@ -257,8 +260,8 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt,
        LASSERT(type != NULL);
 
        /* 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",
@@ -452,7 +455,7 @@ static int qmt_device_prepare(const struct lu_env *env,
        /* initialize on-disk indexes associated with each pool */
        rc = qmt_pool_prepare(env, qmt, qmt_root);
 
-       lu_object_put(env, &qmt_root->do_lu);
+       dt_object_put(env, qmt_root);
        RETURN(rc);
 }
 
@@ -472,9 +475,6 @@ int qmt_glb_init(void)
        ENTRY;
 
        rc = class_register_type(&qmt_obd_ops, NULL, true, NULL,
-#ifndef HAVE_ONLY_PROCFS_SEQ
-                                NULL,
-#endif
                                 LUSTRE_QMT_NAME, &qmt_device_type);
        RETURN(rc);
 }