Whamcloud - gitweb
LU-11582 llite: protect reading inode->i_data.nrpages
[fs/lustre-release.git] / lustre / quota / qmt_dev.c
index 6a819d1..25684fd 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>
@@ -244,11 +244,13 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt,
        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
@@ -452,7 +454,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);
 }