Pull block updates from Jens Axboe: - NVMe updates via Christoph: - Small improvements to the logging functionality (Amit Engel) - Authentication cleanups (Hannes Reinecke) - Cleanup and optimize the DMA mapping cod in the PCIe driver (Keith Busch) - Work around the command effects for Format NVM (Keith Busch) - Misc cleanups (Keith Busch, Christoph Hellwig) - Fix and cleanup freeing single sgl (Keith Busch) - MD updates via Song: - Fix a rare crash during the takeover process - Don't update recovery_cp when curr_resync is ACTIVE - Free writes_pending in md_stop - Change active_io to percpu - Updates to drbd, inching us closer to unifying the out-of-tree driver with the in-tree one (Andreas, Christoph, Lars, Robert) - BFQ update adding support for multi-actuator drives (Paolo, Federico, Davide) - Make brd compliant with REQ_NOWAIT (me) - Fix for IOPOLL and queue entering, fixing stalled IO waiting on timeouts (me) - Fix for REQ_NOWAIT with multiple bios (me) - Fix memory leak in blktrace cleanup (Greg) - Clean up sbitmap and fix a potential hang (Kemeng) - Clean up some bits in BFQ, and fix a bug in the request injection (Kemeng) - Clean up the request allocation and issue code, and fix some bugs related to that (Kemeng) - ublk updates and fixes: - Add support for unprivileged ublk (Ming) - Improve device deletion handling (Ming) - Misc (Liu, Ziyang) - s390 dasd fixes (Alexander, Qiheng) - Improve utility of request caching and fixes (Anuj, Xiao) - zoned cleanups (Pankaj) - More constification for kobjs (Thomas) - blk-iocost cleanups (Yu) - Remove bio splitting from drivers that don't need it (Christoph) - Switch blk-cgroups to use struct gendisk. Some of this is now incomplete as select late reverts were done. (Christoph) - Add bvec initialization helpers, and convert callers to use that rather than open-coding it (Christoph) - Misc fixes and cleanups (Jinke, Keith, Arnd, Bart, Li, Martin, Matthew, Ulf, Zhong) * tag 'for-6.3/block-2023-02-16' of git://git.kernel.dk/linux: (169 commits) brd: use radix_tree_maybe_preload instead of radix_tree_preload block: use proper return value from bio_failfast() block: bio-integrity: Copy flags when bio_integrity_payload is cloned block: Fix io statistics for cgroup in throttle path brd: mark as nowait compatible brd: check for REQ_NOWAIT and set correct page allocation mask brd: return 0/-error from brd_insert_page() block: sync mixed merged request's failfast with 1st bio's Revert "blk-cgroup: pin the gendisk in struct blkcg_gq" Revert "blk-cgroup: pass a gendisk to blkg_lookup" Revert "blk-cgroup: delay blk-cgroup initialization until add_disk" Revert "blk-cgroup: delay calling blkcg_exit_disk until disk_release" Revert "blk-cgroup: move the cgroup information to struct gendisk" nvme-pci: remove iod use_sgls nvme-pci: fix freeing single sgl block: ublk: check IO buffer based on flag need_get_data s390/dasd: Fix potential memleak in dasd_eckd_init() s390/dasd: sort out physical vs virtual pointers usage block: Remove the ALLOC_CACHE_SLACK constant block: make kobj_type structures constant ...
Showing the changes to include/uapi/linux (1 of 109 files). Show all
Unified · Split
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | #define UBLK_CMD_GET_PARAMS 0x09 |
| 20 | 20 | #define UBLK_CMD_START_USER_RECOVERY 0x10 |
| 21 | 21 | #define UBLK_CMD_END_USER_RECOVERY 0x11 |
| 22 | +#define UBLK_CMD_GET_DEV_INFO2 0x12 | |
| 23 | + | |
| 22 | 24 | /* |
| 23 | 25 | * IO commands, issued by ublk server, and handled by ublk driver. |
| 24 | 26 | * |
| @@ -79,6 +81,27 @@ · 54 unmodified lines | ||
| 79 | 81 | |
| 80 | 82 | #define UBLK_F_USER_RECOVERY_REISSUE (1UL << 4) |
| 81 | 83 | |
| 84 | +/* | |
| 85 | + * Unprivileged user can create /dev/ublkcN and /dev/ublkbN. | |
| 86 | + * | |
| 87 | + * /dev/ublk-control needs to be available for unprivileged user, and it | |
| 88 | + * can be done via udev rule to make all control commands available to | |
| 89 | + * unprivileged user. Except for the command of UBLK_CMD_ADD_DEV, all | |
| 90 | + * other commands are only allowed for the owner of the specified device. | |
| 91 | + * | |
| 92 | + * When userspace sends UBLK_CMD_ADD_DEV, the device pair's owner_uid and | |
| 93 | + * owner_gid are stored to ublksrv_ctrl_dev_info by kernel, so far only | |
| 94 | + * the current user's uid/gid is stored, that said owner of the created | |
| 95 | + * device is always the current user. | |
| 96 | + * | |
| 97 | + * We still need udev rule to apply OWNER/GROUP with the stored owner_uid | |
| 98 | + * and owner_gid. | |
| 99 | + * | |
| 100 | + * Then ublk server can be run as unprivileged user, and /dev/ublkbN can | |
| 101 | + * be accessed and managed by its owner represented by owner_uid/owner_gid. | |
| 102 | + */ | |
| 103 | +#define UBLK_F_UNPRIVILEGED_DEV (1UL << 5) | |
| 104 | + | |
| 82 | 105 | /* device state */ |
| 83 | 106 | #define UBLK_S_DEV_DEAD 0 |
| 84 | 107 | #define UBLK_S_DEV_LIVE 1 |
| @@ -98,7 +121,15 @@ struct ublksrv_ctrl_cmd { · 13 unmodified lines | ||
| 98 | 121 | __u64 addr; |
| 99 | 122 | |
| 100 | 123 | /* inline data */ |
| 101 | − __u64 data[2]; | |
| 124 | + __u64 data[1]; | |
| 125 | + | |
| 126 | + /* | |
| 127 | + * Used for UBLK_F_UNPRIVILEGED_DEV and UBLK_CMD_GET_DEV_INFO2 | |
| 128 | + * only, include null char | |
| 129 | + */ | |
| 130 | + __u16 dev_path_len; | |
| 131 | + __u16 pad; | |
| 132 | + __u32 reserved; | |
| 102 | 133 | }; |
| 103 | 134 | |
| 104 | 135 | struct ublksrv_ctrl_dev_info { |
| @@ -118,7 +149,8 @@ struct ublksrv_ctrl_dev_info { · 13 unmodified lines | ||
| 118 | 149 | /* For ublksrv internal use, invisible to ublk driver */ |
| 119 | 150 | __u64 ublksrv_flags; |
| 120 | 151 | |
| 121 | − __u64 reserved0; | |
| 152 | + __u32 owner_uid; /* store by kernel */ | |
| 153 | + __u32 owner_gid; /* store by kernel */ | |
| 122 | 154 | __u64 reserved1; |
| 123 | 155 | __u64 reserved2; |
| 124 | 156 | }; |
| @@ -214,6 +246,17 @@ struct ublk_param_discard { · 89 unmodified lines | ||
| 214 | 246 | __u16 reserved0; |
| 215 | 247 | }; |
| 216 | 248 | |
| 249 | +/* | |
| 250 | + * read-only, can't set via UBLK_CMD_SET_PARAMS, disk_devt is available | |
| 251 | + * after device is started | |
| 252 | + */ | |
| 253 | +struct ublk_param_devt { | |
| 254 | + __u32 char_major; | |
| 255 | + __u32 char_minor; | |
| 256 | + __u32 disk_major; | |
| 257 | + __u32 disk_minor; | |
| 258 | +}; | |
| 259 | + | |
| 217 | 260 | struct ublk_params { |
| 218 | 261 | /* |
| 219 | 262 | * Total length of parameters, userspace has to set 'len' for both |
| @@ -224,10 +267,12 @@ struct ublk_params { · 4 unmodified lines | ||
| 224 | 267 | __u32 len; |
| 225 | 268 | #define UBLK_PARAM_TYPE_BASIC (1 << 0) |
| 226 | 269 | #define UBLK_PARAM_TYPE_DISCARD (1 << 1) |
| 270 | +#define UBLK_PARAM_TYPE_DEVT (1 << 2) | |
| 227 | 271 | __u32 types; /* types of parameter included */ |
| 228 | 272 | |
| 229 | 273 | struct ublk_param_basic basic; |
| 230 | 274 | struct ublk_param_discard discard; |
| 275 | + struct ublk_param_devt devt; | |
| 231 | 276 | }; |
| 232 | 277 | |
| 233 | 278 | #endif |