Fix issues found with --enable-lu_ref.
i=adilger
i=oleg
i=zam
#define OBD_RECOVERY_MAX_TIME (obd_timeout * 18) /* b13079 */
+void target_cancel_recovery_timer(struct obd_device *obd);
+void target_stop_recovery_thread(struct obd_device *obd);
+void target_cleanup_recovery(struct obd_device *obd);
int target_queue_recovery_request(struct ptlrpc_request *req,
struct obd_device *obd);
void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id);
#define OBD_FAIL_LDLM_OST_FAIL_RACE 0x316
#define OBD_FAIL_LDLM_INTR_CP_AST 0x317
#define OBD_FAIL_LDLM_CP_BL_RACE 0x318
+#define OBD_FAIL_LDLM_NEW_LOCK 0x319
/* LOCKLESS IO */
#define OBD_FAIL_LDLM_SET_CONTENTION 0x385
target_request_copy_put(req);
}
}
-
-/* obd_processing_task_lock should be held */
-static void target_cancel_recovery_timer(struct obd_device *obd)
-{
- CDEBUG(D_HA, "%s: cancel recovery timer\n", obd->obd_name);
- cfs_timer_disarm(&obd->obd_recovery_timer);
-}
+#endif
/* Called from a cleanup function if the device is being cleaned up
forcefully. The exports should all have been disconnected already,
Because the obd_stopping flag is set, no new requests should be received.
*/
-static void target_cleanup_recovery(struct obd_device *obd)
+void target_cleanup_recovery(struct obd_device *obd)
{
struct ptlrpc_request *req, *n;
cfs_list_t clean_list;
EXIT;
}
-#endif
+
+/* obd_processing_task_lock should be held */
+void target_cancel_recovery_timer(struct obd_device *obd)
+{
+ CDEBUG(D_HA, "%s: cancel recovery timer\n", obd->obd_name);
+ cfs_timer_disarm(&obd->obd_recovery_timer);
+}
/* extend = 1 means require at least "duration" seconds left in the timer,
extend = 0 means set the total duration (start_recovery_timer) */
return rc;
}
-static void target_stop_recovery_thread(struct obd_device *obd)
+void target_stop_recovery_thread(struct obd_device *obd)
{
cfs_spin_lock_bh(&obd->obd_processing_task_lock);
if (obd->obd_recovery_data.trd_processing_task > 0) {
GOTO(out, 0);
}
+ if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_NEW_LOCK))
+ GOTO(out, 0);
+
RETURN(lock);
out:
- if (lock->l_lvb_data)
- OBD_FREE(lock->l_lvb_data, lvb_len);
- ldlm_interval_free(ldlm_interval_detach(lock));
- OBD_SLAB_FREE(lock, ldlm_lock_slab, sizeof(*lock));
+ ldlm_lock_destroy(lock);
+ LDLM_LOCK_RELEASE(lock);
return NULL;
}
EXPORT_SYMBOL(client_connect_import);
EXPORT_SYMBOL(client_disconnect_export);
EXPORT_SYMBOL(server_disconnect_export);
+EXPORT_SYMBOL(target_stop_recovery_thread);
EXPORT_SYMBOL(target_handle_connect);
+EXPORT_SYMBOL(target_cleanup_recovery);
EXPORT_SYMBOL(target_destroy_export);
+EXPORT_SYMBOL(target_cancel_recovery_timer);
EXPORT_SYMBOL(target_send_reply);
EXPORT_SYMBOL(target_queue_recovery_request);
EXPORT_SYMBOL(target_handle_ping);
cfs_list_for_each_entry_safe(lock, next, &list, l_pending_chain) {
cfs_list_del_init(&lock->l_pending_chain);
if (rc) {
- LDLM_LOCK_PUT(lock);
+ LDLM_LOCK_RELEASE(lock);
continue; /* or try to do the rest? */
}
rc = replay_one_lock(imp, lock);
- LDLM_LOCK_PUT(lock);
+ LDLM_LOCK_RELEASE(lock);
}
cfs_atomic_dec(&imp->imp_replay_inflight);
/* someone won the race and added the resource before */
ldlm_resource_getref(old_res);
cfs_spin_unlock(&ns->ns_hash_lock);
+ /* clean lu_ref for failed resource */
+ lu_ref_fini(&res->lr_reference);
OBD_SLAB_FREE(res, ldlm_resource_slab, sizeof *res);
/* synchronize WRT resource creation */
if (ns->ns_lvbo && ns->ns_lvbo->lvbo_init) {
break;
case OBD_IOC_ABORT_RECOVERY:
CERROR("Aborting recovery for device %s\n", obd->obd_name);
- target_recovery_fini(obd);
+ target_stop_recovery_thread(obd);
rc = 0;
break;
case OBD_IOC_CHANGELOG_REG:
lu_ref_print(__ref); \
cfs_spin_unlock(&__ref->lf_guard); \
lu_ref_print_all(); \
- cfs_spin_lock(&__ref->lf_guard); \
LASSERT(0); \
+ cfs_spin_lock(&__ref->lf_guard); \
} \
} while (0)
switch (cmd) {
case OBD_IOC_ABORT_RECOVERY: {
LCONSOLE_WARN("%s: Aborting recovery.\n", obd->obd_name);
- target_recovery_fini(obd);
+ target_stop_recovery_thread(obd);
RETURN(0);
}
ping_evictor_stop();
- LASSERT(obd->obd_recovering == 0);
+ cfs_spin_lock_bh(&obd->obd_processing_task_lock);
+ if (obd->obd_recovering) {
+ target_cancel_recovery_timer(obd);
+ obd->obd_recovering = 0;
+ }
+ cfs_spin_unlock_bh(&obd->obd_processing_task_lock);
cfs_down(&ost->ost_health_sem);
ptlrpc_unregister_service(ost->ost_service);
obd = class_exp2obd(exp);
if (cfs_list_empty(&obd->obd_evict_list)) {
- class_incref(obd, __FUNCTION__, cfs_current());
+ class_incref(obd, "evictor", obd);
cfs_list_add(&obd->obd_evict_list, &pet_list);
}
cfs_spin_unlock(&pet_lock);
cfs_list_del_init(&obd->obd_evict_list);
cfs_spin_unlock(&pet_lock);
- class_decref(obd, __FUNCTION__, cfs_current());
+ class_decref(obd, "evictor", obd);
}
CDEBUG(D_HA, "Exiting Ping Evictor\n");
}
run_test 74b "ldlm_enqueue freed-export error path, touch (shouldn't LBUG)"
+test_74c() {
+#define OBD_FAIL_LDLM_NEW_LOCK
+ lctl set_param fail_loc=0x80000319
+ touch $DIR/$tfile && error "Touch successful"
+ true
+}
+run_test 74c "ldlm_lock_create error path, (shouldn't LBUG)"
+
num_inodes() {
awk '/lustre_inode_cache/ {print $2; exit}' /proc/slabinfo
}