History

dm ioctl: fix alignment of event number in the device list

The size of struct dm_name_list is different on 32-bit and 64-bit kernels (so "(nl + 1)" differs between 32-bit and 64-bit kernels). This mismatch caused some harmless difference in padding when using 32-bit or 64-bit kernel. Commit 23d70c5e52dd ("dm ioctl: report event number in DM_LIST_DEVICES") added reporting event number in the output of DM_LIST_DEVICES_CMD. This difference in padding makes it impossible for userspace to determine the location of the event number (the location would be different when running on 32-bit and 64-bit kernels). Fix the padding by using offsetof(struct dm_name_list, name) instead of sizeof(struct dm_name_list) to determine the location of entries. Also, the ioctl version number is incremented to 37 so that userspace can use the version number to determine that the event number is present and correctly located. In addition, a global event is now raised when a DM device is created, removed, renamed or when table is swapped, so that the user can monitor for device changes.

Mikulas Patocka committed 9 years ago

Commit 62e08241 parent e19b2054 files · +35 −17Browse files

Showing the changes to include/uapi/linux (1 of 4 files). Show all

Unified · Split

include/uapi/linux/dm-ioctl.h+2−2
@@ -269,9 +269,9 @@ enum { · 268 unmodified lines
269#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)269#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
270 270
271#define DM_VERSION_MAJOR 4271#define DM_VERSION_MAJOR 4
272#define DM_VERSION_MINOR 36272#define DM_VERSION_MINOR 37
273#define DM_VERSION_PATCHLEVEL 0273#define DM_VERSION_PATCHLEVEL 0
274#define DM_VERSION_EXTRA "-ioctl (2017-06-09)"274#define DM_VERSION_EXTRA "-ioctl (2017-09-20)"
275 275
276/* Status bits */276/* Status bits */
277#define DM_READONLY_FLAG (1 << 0) /* In/Out */277#define DM_READONLY_FLAG (1 << 0) /* In/Out */