Whamcloud - gitweb
LU-6245 libcfs: remove wrappers for timer functions
[fs/lustre-release.git] / lustre / obdclass / obd_mount_server.c
index 55a9306..da64534 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2013, 2015, Intel Corporation.
+ * Copyright (c) 2013, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -407,6 +403,7 @@ int lustre_register_lwp_item(const char *lwpname, struct obd_export **exp,
 {
        struct obd_device        *lwp;
        struct lwp_register_item *lri;
+       bool cb = false;
        ENTRY;
 
        LASSERTF(strlen(lwpname) < MTI_NAME_MAXLEN, "lwpname is too long %s\n",
@@ -445,9 +442,11 @@ int lustre_register_lwp_item(const char *lwpname, struct obd_export **exp,
 
        spin_lock(&lwp_register_list_lock);
        list_add(&lri->lri_list, &lwp_register_list);
+       if (*exp != NULL)
+               cb = true;
        spin_unlock(&lwp_register_list_lock);
 
-       if (*exp != NULL && cb_func != NULL)
+       if (cb && cb_func != NULL)
                cb_func(cb_data);
        lustre_put_lwp_item(lri);
 
@@ -527,11 +526,12 @@ again:
                if (*lri->lri_exp != NULL)
                        continue;
                *lri->lri_exp = class_export_get(exp);
+               if (lri->lri_cb_func == NULL)
+                       continue;
                atomic_inc(&lri->lri_ref);
                spin_unlock(&lwp_register_list_lock);
 
-               if (lri->lri_cb_func != NULL)
-                       lri->lri_cb_func(lri->lri_cb_data);
+               lri->lri_cb_func(lri->lri_cb_data);
                lustre_put_lwp_item(lri);
 
                /* Others may have changed the list after we unlock, we have
@@ -1904,23 +1904,20 @@ void server_calc_timeout(struct lustre_sb_info *lsi, struct obd_device *obd)
 
        if (has_ir) {
                int new_soft = soft;
-               int new_hard = hard;
 
                /* adjust timeout value by imperative recovery */
-
                new_soft = (soft * factor) / OBD_IR_FACTOR_MAX;
-               new_hard = (hard * factor) / OBD_IR_FACTOR_MAX;
-
                /* make sure the timeout is not too short */
                new_soft = max(min, new_soft);
-               new_hard = max(new_soft, new_hard);
 
                LCONSOLE_INFO("%s: Imperative Recovery enabled, recovery "
                              "window shrunk from %d-%d down to %d-%d\n",
-                             obd->obd_name, soft, hard, new_soft, new_hard);
+                             obd->obd_name, soft, hard, new_soft, hard);
 
                soft = new_soft;
-               hard = new_hard;
+       } else {
+               LCONSOLE_INFO("%s: Imperative Recovery not enabled, recovery "
+                             "window %d-%d\n", obd->obd_name, soft, hard);
        }
 
        /* we're done */