dankimmel commented on this pull request.


> +     lua_pushlightuserdata(state, &ri);
+       lua_setfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY);
+       VERIFY3U(3, ==, lua_gettop(state));
+
+       /*
+        * Tell the Lua interpreter to call our handler every count
+        * instructions. Channel programs that execute too many instructions
+        * should die with ETIME.
+        */
+       (void) lua_sethook(state, zcp_lua_counthook, LUA_MASKCOUNT,
+           zfs_lua_check_instrlimit_interval);
+
+       /*
+        * Tell the Lua memory allocator to stop using KM_SLEEP before handing
+        * off control to the channel program. Channel programs that use too
+        * much memory should die with ENOSPC.

Yeah, this is actually disambiguating two separate, but similar, error cases to 
handle. This is explained in the comment above `lzc_channel_program` in 
`libzfs_core.c`:
```
 * ENOMEM   The program fully executed, but the output buffer was not large
 *          enough to store the returned value. No output is returned through
 *          'outnvl'.
 *
 * ENOSPC   The program was terminated because it exceeded its memory usage
 *          limit. Some portion of the channel program may have executed and
 *          committed changes to disk. No output is returned through 'outnvl'.
```
Let us know if you think we should break these apart using different error 
numbers than the ones we chose.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/397#discussion_r122002673
------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/Tffb276f83a8ecdd2-M4cb3d1ac1ee63020118decde
Powered by Topicbox: https://topicbox.com

Reply via email to