#include <sys/dmu_objset.h>
#include <sys/fs/zfs.h>
-uint32_t zio_injection_enabled;
+uint32_t zio_injection_enabled = 0;
typedef struct inject_handler {
int zi_id;
zio_clear_fault(int id)
{
inject_handler_t *handler;
- int ret;
rw_enter(&inject_lock, RW_WRITER);
break;
if (handler == NULL) {
- ret = ENOENT;
- } else {
- list_remove(&inject_handlers, handler);
- spa_inject_delref(handler->zi_spa);
- kmem_free(handler, sizeof (inject_handler_t));
- atomic_add_32(&zio_injection_enabled, -1);
- ret = 0;
+ rw_exit(&inject_lock);
+ return (ENOENT);
}
+ list_remove(&inject_handlers, handler);
rw_exit(&inject_lock);
- return (ret);
+ spa_inject_delref(handler->zi_spa);
+ kmem_free(handler, sizeof (inject_handler_t));
+ atomic_add_32(&zio_injection_enabled, -1);
+
+ return (0);
}
void
list_destroy(&inject_handlers);
rw_destroy(&inject_lock);
}
+
+#if defined(_KERNEL) && defined(HAVE_SPL)
+module_param(zio_injection_enabled, int, 0644);
+MODULE_PARM_DESC(zio_injection_enabled, "Enable fault injection");
+#endif