Whamcloud - gitweb
LU-10337 mdt: Allow open of open orphans
[fs/lustre-release.git] / lustre / osc / osc_object.c
index 025e68a..6b44d63 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -310,7 +310,7 @@ int osc_object_is_contended(struct osc_object *obj)
 {
        struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev);
        time64_t osc_contention_time = dev->od_contention_time;
-       time64_t retry_time;
+       ktime_t retry_time;
 
         if (OBD_FAIL_CHECK(OBD_FAIL_OSC_OBJECT_CONTENTION))
                 return 1;
@@ -322,8 +322,9 @@ int osc_object_is_contended(struct osc_object *obj)
         * I like copy-paste. the code is copied from
         * ll_file_is_contended.
         */
-       retry_time = obj->oo_contention_time + osc_contention_time;
-       if (ktime_get_seconds() > retry_time) {
+       retry_time = ktime_add_ns(obj->oo_contention_time,
+                                 osc_contention_time * NSEC_PER_SEC);
+       if (ktime_after(ktime_get(), retry_time)) {
                osc_object_clear_contended(obj);
                return 0;
        }