diff --git a/include/sys/zfs_ioctl.h b/include/sys/zfs_ioctl.h index 180502802..8174242ab 100644 --- a/include/sys/zfs_ioctl.h +++ b/include/sys/zfs_ioctl.h @@ -534,10 +534,22 @@ typedef struct zfs_cmd { zfs_share_t zc_share; dmu_objset_stats_t zc_objset_stats; struct drr_begin zc_begin_record; - zinject_record_t zc_inject_record; - uint32_t zc_defer_destroy; - uint32_t zc_flags; - uint64_t zc_action_handle; + + /* + * zinject_record_t grew past its original size, which would push out + * the size of zfs_cmd_t. To adjust for this, we allow it to use the + * space after it, since those fields aren't used with ZFS_IOC_INJECT. + */ + union { + zinject_record_t zc_inject_record; + struct { + char zc_pad1[sizeof (zinject_record_t) - 16]; + uint32_t zc_defer_destroy; + uint32_t zc_flags; + uint64_t zc_action_handle; + }; + }; + int zc_cleanup_fd; uint8_t zc_simple; uint8_t zc_pad[3]; /* alignment */ @@ -548,6 +560,20 @@ typedef struct zfs_cmd { uint64_t zc_zoneid; } zfs_cmd_t; +/* + * zfs_cmd_t (and by extension, it's member structs) must always be the same + * size. Changing it will break compatibility between the kernel module and the + * userspace tools. + * + * This test is convoluted because MAXPATHLEN and MAXNAMELEN can vary across + * platforms. We include them directly here, which means it won't trip if those + * ever change, but if that happens we likely have other things to worry about. + */ +#define _expected_zfs_cmd_size ((MAXPATHLEN*3)+MAXNAMELEN+1200) +_Static_assert(sizeof (zfs_cmd_t) == _expected_zfs_cmd_size, + "zfs_cmd_t has wrong size"); +#undef _expected_zfs_cmd_size + typedef struct zfs_useracct { char zu_domain[256]; uid_t zu_rid; diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 31f3eb613..01fe98db8 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -2617,6 +2617,9 @@ + + + @@ -2789,7 +2792,7 @@ - + @@ -2860,42 +2863,55 @@ - + - - - - - - - - - - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + @@ -3171,7 +3187,7 @@ - + @@ -3183,7 +3199,7 @@ - + @@ -3256,36 +3272,36 @@ - + - + - + - + - + - + - + - + - + - + @@ -3293,7 +3309,7 @@ - + @@ -3304,7 +3320,7 @@ - + @@ -3315,7 +3331,7 @@ - + @@ -3332,7 +3348,7 @@ - + @@ -3340,18 +3356,18 @@ - + - + - + - + @@ -3359,7 +3375,7 @@ - + @@ -3367,7 +3383,7 @@ - + @@ -4152,6 +4168,12 @@ + + + + + + @@ -4590,12 +4612,6 @@ - - - - - - @@ -5277,6 +5293,12 @@ + + + + + + @@ -7237,7 +7259,7 @@ - + @@ -7255,7 +7277,7 @@ - + @@ -7602,10 +7624,10 @@ - + - + @@ -7613,10 +7635,10 @@ - + - + diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index a90aa7acf..63904f447 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -1116,13 +1116,6 @@ - - - - - - - @@ -1279,6 +1272,9 @@ + + + @@ -1765,7 +1761,7 @@ - + @@ -2156,7 +2152,7 @@ - + @@ -2227,42 +2223,56 @@ - + - - - - - - - - - - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + @@ -2558,14 +2568,14 @@ + - - - - - + + + + @@ -2781,6 +2791,13 @@ + + + + + + + @@ -2794,6 +2811,12 @@ + + + + + + @@ -3178,6 +3201,12 @@ + + + + + +