Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Aug 2018 23:15:10 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337194 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201808022315.w72NFAEE006162@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Aug  2 23:15:10 2018
New Revision: 337194
URL: https://svnweb.freebsd.org/changeset/base/337194

Log:
  MFV r337193:
  9424 ztest failure: "unprotected error in call to Lua API (Invalid value type 'f
  unction' 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>

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c	Thu Aug  2 23:13:40 2018	(r337193)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c	Thu Aug  2 23:15:10 2018	(r337194)
@@ -433,7 +433,7 @@ zcp_lua_to_nvlist_impl(lua_State *state, int index, nv
 /*
  * 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)
 {
 	/*
@@ -445,7 +445,7 @@ zcp_lua_to_nvlist(lua_State *state, int index, nvlist_
 		(void) lua_error(state);
 }
 
-int
+static int
 zcp_lua_to_nvlist_helper(lua_State *state)
 {
 	nvlist_t *nv = (nvlist_t *)lua_touserdata(state, 2);
@@ -454,11 +454,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);
@@ -904,6 +905,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a
 			    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,
@@ -965,6 +967,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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808022315.w72NFAEE006162>