X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzio_inject.c;h=293f267fc9ed30716d8891b4638a2778ad715d21;hb=761394b3af152895ac68a970a91a4f8a917c547b;hp=16eaed6688e59270b60de98a6b8b1d6c80d804bf;hpb=428870ff734fdaccc342b33fc53cf94724409a46;p=zfs.git diff --git a/module/zfs/zio_inject.c b/module/zfs/zio_inject.c index 16eaed6..293f267 100644 --- a/module/zfs/zio_inject.c +++ b/module/zfs/zio_inject.c @@ -46,7 +46,7 @@ #include #include -uint32_t zio_injection_enabled; +uint32_t zio_injection_enabled = 0; typedef struct inject_handler { int zi_id; @@ -476,7 +476,6 @@ int zio_clear_fault(int id) { inject_handler_t *handler; - int ret; rw_enter(&inject_lock, RW_WRITER); @@ -486,18 +485,18 @@ zio_clear_fault(int id) 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 @@ -514,3 +513,8 @@ zio_inject_fini(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