diff options
author | Alexander Motin <mav@FreeBSD.org> | 2018-08-02 23:13:40 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2018-08-02 23:13:40 +0000 |
commit | aee8d62a6f4f9b5d51c066ac0ce556c60cacb435 (patch) | |
tree | 3c383b7be28ecee538960d54436ac7874b579f93 /uts | |
parent | 9f2ee4de7e42acb4690d4d55846a801797348d87 (diff) | |
download | src-aee8d62a6f4f9b5d51c066ac0ce556c60cacb435.tar.gz src-aee8d62a6f4f9b5d51c066ac0ce556c60cacb435.zip |
9424 ztest failure: "unprotected error in call to Lua API (Invalid value type 'function' for key 'error')"
illumos/illumos-gate@fe3ba4d1227d8746116ece7240682b13595c3142
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Don Brady <don.brady@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>
Notes
Notes:
svn path=/vendor-sys/illumos/dist/; revision=337193
Diffstat (limited to 'uts')
-rw-r--r-- | uts/common/fs/zfs/zcp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/uts/common/fs/zfs/zcp.c b/uts/common/fs/zfs/zcp.c index 5ef77044e617..bad8a56f5846 100644 --- a/uts/common/fs/zfs/zcp.c +++ b/uts/common/fs/zfs/zcp.c @@ -426,7 +426,7 @@ zcp_lua_to_nvlist_impl(lua_State *state, int index, nvlist_t *nvl, /* * Convert a lua value to an nvpair, adding it to an nvlist with the given key. */ -void +static void zcp_lua_to_nvlist(lua_State *state, int index, nvlist_t *nvl, const char *key) { /* @@ -438,7 +438,7 @@ zcp_lua_to_nvlist(lua_State *state, int index, nvlist_t *nvl, const char *key) (void) lua_error(state); } -int +static int zcp_lua_to_nvlist_helper(lua_State *state) { nvlist_t *nv = (nvlist_t *)lua_touserdata(state, 2); @@ -447,11 +447,12 @@ zcp_lua_to_nvlist_helper(lua_State *state) return (0); } -void +static void zcp_convert_return_values(lua_State *state, nvlist_t *nvl, const char *key, zcp_eval_arg_t *evalargs) { int err; + VERIFY3U(1, ==, lua_gettop(state)); lua_pushcfunction(state, zcp_lua_to_nvlist_helper); lua_pushlightuserdata(state, (char *)key); lua_pushlightuserdata(state, nvl); @@ -897,6 +898,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) ZCP_RET_RETURN, evalargs); } else if (return_count > 1) { evalargs->ea_result = SET_ERROR(ECHRNG); + lua_settop(state, 0); (void) lua_pushfstring(state, "Multiple return " "values not supported"); zcp_convert_return_values(state, evalargs->ea_outnvl, @@ -958,6 +960,7 @@ static void zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) { evalargs->ea_result = SET_ERROR(ECHRNG); + lua_settop(evalargs->ea_state, 0); (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", poolname); zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, |