Actions
Feature #10604
closedstruct zfs_cmd 32-bit and 64-bit versions are out of alignment
Start date:
2019-03-29
Due date:
% Done:
90%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
Description
The zfsdev_ioctl() implementation is assuming the 32-bit version of zfs_cmd structure has exactly the same layout as 64-bit version, unfortunately those layouts has become different likely since large dnode patch, resulting with zfs send not working.
The tail output from 64-bit (kernel) kmdb:
> ::print -hta struct zfs_cmd ff8 zinject_record_t zc_inject_record { ff8 uint64_t zi_objset 1000 uint64_t zi_object 1008 uint64_t zi_start 1010 uint64_t zi_end 1018 uint64_t zi_guid 1020 uint32_t zi_level 1024 uint32_t zi_error 1028 uint64_t zi_type 1030 uint32_t zi_freq 1034 uint32_t zi_failfast 1038 char [256] zi_func 1138 uint32_t zi_iotype 113c int32_t zi_duration 1140 uint64_t zi_timer 1148 uint64_t zi_nlanes 1150 uint32_t zi_cmd 1154 uint32_t zi_pad 1158 uint32_t zi_dvas 115c uint32_t <<HOLE>> } 1160 uint32_t zc_defer_destroy 1164 uint32_t zc_flags 1168 uint64_t zc_action_handle 1170 int zc_cleanup_fd 1174 uint8_t zc_simple 1175 uint8_t [3] zc_pad3 1178 boolean_t zc_resumable 117c uint32_t zc_pad4 1180 uint64_t zc_sendobj 1188 uint64_t zc_fromobj 1190 uint64_t zc_createtxg 1198 zfs_stat_t zc_stat { 1198 uint64_t zs_gen 11a0 uint64_t zs_mode 11a8 uint64_t zs_links 11b0 uint64_t [2] zs_ctime } } >
And the same output from crashed zfs command (32-bit layout):
ff8 zinject_record_t zc_inject_record { ff8 uint64_t zi_objset 1000 uint64_t zi_object 1008 uint64_t zi_start 1010 uint64_t zi_end 1018 uint64_t zi_guid 1020 uint32_t zi_level 1024 uint32_t zi_error 1028 uint64_t zi_type 1030 uint32_t zi_freq 1034 uint32_t zi_failfast 1038 char [256] zi_func 1138 uint32_t zi_iotype 113c int32_t zi_duration 1140 uint64_t zi_timer 1148 uint64_t zi_nlanes 1150 uint32_t zi_cmd 1154 uint32_t zi_pad 1158 uint32_t zi_dvas } 115c uint32_t zc_defer_destroy 1160 uint32_t zc_flags 1164 uint64_t zc_action_handle 116c int zc_cleanup_fd 1170 uint8_t zc_simple 1171 unsigned <<HOLE>> :24 1174 boolean_t zc_resumable 1178 uint8_t [3] zc_pad 117b uint8_t <<HOLE>> 117c uint64_t zc_sendobj 1184 uint64_t zc_fromobj 118c uint64_t zc_createtxg 1194 zfs_stat_t zc_stat { 1194 uint64_t zs_gen 119c uint64_t zs_mode 11a4 uint64_t zs_links 11ac uint64_t [2] zs_ctime } } >
We will need to remove padding from zinject_record_t, and fix the sequence after field zc_simple in zfs_cmd. Note that yes, we are out of sync with ZoL here, and yes, we will need to keep the layout of this structure in mind and adjust if needed.
Actions