+static inline int target_check_recovery_timer(struct obd_device *target)
+{
+ ktime_t remaining;
+ s64 timeout;
+
+ if (!target->obd_recovering || target->obd_recovery_start == 0)
+ return 0;
+
+ remaining = hrtimer_expires_remaining(&target->obd_recovery_timer);
+ timeout = ktime_divns(remaining, NSEC_PER_SEC);
+ if (timeout > -30)
+ return 0;
+
+ /* the recovery timer should expire, but it isn't triggered,
+ * it's better to abort the recovery of this target to speed up
+ * the recovery of the whole cluster. */
+ spin_lock(&target->obd_dev_lock);
+ if (target->obd_recovering) {
+ CERROR("%s: Aborting recovery\n", target->obd_name);
+ target->obd_abort_recovery = 1;
+ wake_up(&target->obd_next_transno_waitq);
+ }
+ spin_unlock(&target->obd_dev_lock);
+ return 0;
+}
+