| 06dad603 | 30-Sep-2026 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: implement `Send` and `Sync` for `TagSet`
`TagSet` never implemented `Send` or `Sync`. This did not matter until commit "rust: block: fix `Send` bound for `GenDisk`" made `GenDisk: Send`
rust: block: implement `Send` and `Sync` for `TagSet`
`TagSet` never implemented `Send` or `Sync`. This did not matter until commit "rust: block: fix `Send` bound for `GenDisk`" made `GenDisk: Send` depend on `Arc<TagSet<T>>: Send`, which in turn requires `TagSet<T>: Send + Sync`. With that bound unsatisfiable, `GenDisk` is never `Send`, and the rnull driver fails to build once configfs requires `GroupOperations::Child: Send`.
`TagSet` owns no data typed by `T`. It only wraps the C `struct blk_mq_tag_set`, which can be dropped from any thread by calling `blk_mq_free_tag_set`. Thus, implement `Send` and `Sync` for `TagSet` unconditionally.
Reported-by: Thorsten Leemhuis <linux@leemhuis.info> Closes: https://lore.kernel.org/r/d1381ed8-eab8-4fd7-8b15-1e94876d7099@leemhuis.info Suggested-by: Gary Guo <gary@garyguo.net> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Tested-by: Thorsten Leemhuis <linux@leemhuis.info> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20260930-tag-set-send-sync-v1-1-51acdb36f4bb@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| 67b7a272 | 29-Sep-2026 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: require `Sync` for `Operations::QueueData`
The queue data installed in a `GenDisk` is stored in the request queue and handed back to the driver as a shared borrow through the `queue_rq`
rust: block: require `Sync` for `Operations::QueueData`
The queue data installed in a `GenDisk` is stored in the request queue and handed back to the driver as a shared borrow through the `queue_rq` and `commit_rqs` callbacks. Both callbacks obtain that borrow via `ForeignOwnable::borrow` and may execute concurrently on several CPUs, since the block layer runs one hardware queue per CPU. That means a shared reference to the same queue data can be live on multiple threads at once, which is only sound when the referent is `Sync`.
The initial `GenDisk` private data support omitted this bound, so a driver could install a non-`Sync` type as queue data and then access it concurrently from multiple CPUs without synchronization. Add a `Sync` bound to the `QueueData` associated type to rule that out.
Fixes: 90d952fac8ac ("rust: block: add `GenDisk` private data support") Cc: stable@vger.kernel.org Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://msgid.link/20260608-queue-data-sync-v1-1-0efff051aaf3@kernel.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260929-rust-block-for-v7-4-rc1-b4-v1-9-642a4c1aebd7@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| c595572d | 29-Sep-2026 |
Sophon Z <aiqubits@hotmail.com> |
rust: block: Fix GenDiskBuilder block size documentation
GenDiskBuilder::validate_block_size() accepts powers of two from 512 through PAGE_SIZE, but the documentation for logical_block_size() and ph
rust: block: Fix GenDiskBuilder block size documentation
GenDiskBuilder::validate_block_size() accepts powers of two from 512 through PAGE_SIZE, but the documentation for logical_block_size() and physical_block_size() states that the maximum is 4096.
Use PAGE_SIZE for both documented upper bounds so that the documentation matches validation on architectures with larger page sizes.
Signed-off-by: Sophon Z <aiqubits@hotmail.com> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://msgid.link/20260831-fix-gendisk-block-size-docs-v1-1-900546005799@hotmail.com Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260929-rust-block-for-v7-4-rc1-b4-v1-6-642a4c1aebd7@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| 67a11f2e | 29-Sep-2026 |
Alvin Sun <alvin.sun@linux.dev> |
rust: block: gen_disk: set fops.owner from driver module pointer
Set `fops.owner` from the driver module pointer via `this_module::<T::OwnerModule>().as_ptr()` instead of defaulting to null, so the
rust: block: gen_disk: set fops.owner from driver module pointer
Set `fops.owner` from the driver module pointer via `this_module::<T::OwnerModule>().as_ptr()` instead of defaulting to null, so the module cannot be unloaded while a block device is still in use.
Signed-off-by: Alvin Sun <alvin.sun@linux.dev> Link: https://msgid.link/20260811-fix-gendisk-owner-v1-1-c0fe4a449ecb@linux.dev Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260929-rust-block-for-v7-4-rc1-b4-v1-5-642a4c1aebd7@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| e502b667 | 29-Sep-2026 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: fix `Send` bound for `GenDisk`
The `Send` implementation for `GenDisk<T>` was conditioned on `T: Send`. This constrains the wrong type. `T` is the `Operations` implementation, which is
rust: block: fix `Send` bound for `GenDisk`
The `Send` implementation for `GenDisk<T>` was conditioned on `T: Send`. This constrains the wrong type. `T` is the `Operations` implementation, which is typically a zero-sized marker type that carries no data, so `T: Send` says nothing about whether the data a `GenDisk` actually owns can be moved to another thread.
A `GenDisk<T>` owns the queue data `T::QueueData` (stored as the `gendisk`'s `queuedata` and dropped when the `GenDisk` is dropped) and an `Arc<TagSet<T>>`. These are the values transferred when a `GenDisk` is sent across a thread boundary, so the `Send` bound must constrain exactly them. Bound `T::QueueData: Send` and `Arc<TagSet<T>>: Send` instead.
Fixes: 3253aba3408a ("rust: block: introduce `kernel::block::mq` module") Cc: stable@vger.kernel.org Reported-by: Priya Bala Govindasamy <pgovind2@uci.edu>, Dylan Zueck <dzueck@uci.edu>, Yuan Tan <ytan089@ucr.edu> Closes: https://lore.kernel.org/all/cover.1780633578.git.ytan089@ucr.edu Signed-off-by: Yuan Tan <ytan089@ucr.edu> Link: https://msgid.link/20260709100100.604252-1-yuantan098@gmail.com [ Andreas: Fix tags to make checkpatch happy. Change summary line. ] Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260929-rust-block-for-v7-4-rc1-b4-v1-4-642a4c1aebd7@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| 06e75dbe | 29-Sep-2026 |
Alvin Sun <alvin.sun@linux.dev> |
rust: block: mq: remove redundant imports and format
Drop `Result`, `Pin`, `pin_data`, `pinned_drop`, `PinInit`, and `try_pin_init` imports already provided by `kernel::prelude`.
Simplify `error` i
rust: block: mq: remove redundant imports and format
Drop `Result`, `Pin`, `pin_data`, `pinned_drop`, `PinInit`, and `try_pin_init` imports already provided by `kernel::prelude`.
Simplify `error` imports and flatten parameters formatting.
Reviewed-by: Onur Özkan <work@onurozkan.dev> Signed-off-by: Alvin Sun <alvin.sun@linux.dev> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://msgid.link/20260521-miscdev-use-format-v3-5-56240ca70d0c@linux.dev Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://patch.msgid.link/20260929-rust-block-for-v7-4-rc1-b4-v1-2-642a4c1aebd7@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| 29577713 | 30-May-2026 |
Haoze Xie <royenheart@gmail.com> |
rust: block: fix GenDisk cleanup paths
GenDiskBuilder::build() still has fallible work after __blk_mq_alloc_disk(), but its error path only recovers the foreign queue data. That leaks the temporary
rust: block: fix GenDisk cleanup paths
GenDiskBuilder::build() still has fallible work after __blk_mq_alloc_disk(), but its error path only recovers the foreign queue data. That leaks the temporary gendisk and request_queue until later teardown. If the caller moved the last Arc<TagSet<T>> into build(), the leaked queue can retain blk-mq state after the tag set is dropped.
Fix the pre-registration failure path by dropping the temporary gendisk reference with put_disk() before recovering queue_data, so disk_release() can tear down the owned queue.
Also pair GenDisk::drop() with put_disk() after del_gendisk(). Once a Rust GenDisk has been added with device_add_disk(), del_gendisk() only unregisters it; the final gendisk reference still has to be dropped to complete the release path.
Fixes: 3253aba3408a ("rust: block: introduce `kernel::block::mq` module") Cc: stable@kernel.org Reported-by: Yuan Tan <yuantan098@gmail.com> Reported-by: Xin Liu <bird@lzu.edu.cn> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Signed-off-by: Haoze Xie <royenheart@gmail.com> Signed-off-by: Ren Wei <n05ec@lzu.edu.cn> Link: https://patch.msgid.link/b70aff9a920cc42110fe5cf454c3099561863519.1780063368.git.royenheart@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| 880528ea | 20-Jan-2026 |
Ke Sun <sunke@kylinos.cn> |
rust: block: mq: use pin_init::zeroed() for tag_set
Replace unsafe core::mem::zeroed() with pin_init::zeroed() for blk_mq_tag_set initialization.
Signed-off-by: Ke Sun <sunke@kylinos.cn> Acked-by:
rust: block: mq: use pin_init::zeroed() for tag_set
Replace unsafe core::mem::zeroed() with pin_init::zeroed() for blk_mq_tag_set initialization.
Signed-off-by: Ke Sun <sunke@kylinos.cn> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/20260120083824.477339-4-sunke@kylinos.cn Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| 4ec05284 | 02-Sep-2025 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: add remote completion to `Request`
Allow users of rust block device driver API to schedule completion of requests via `blk_mq_complete_request_remote`.
Reviewed-by: Alice Ryhl <alicery
rust: block: add remote completion to `Request`
Allow users of rust block device driver API to schedule completion of requests via `blk_mq_complete_request_remote`.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250902-rnull-up-v6-16-v7-16-b5212cc89b98@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| bde50e28 | 02-Sep-2025 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: mq: fix spelling in a safety comment
Add code block quotes to a safety comment.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com
rust: block: mq: fix spelling in a safety comment
Add code block quotes to a safety comment.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250902-rnull-up-v6-16-v7-15-b5212cc89b98@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| 90d952fa | 02-Sep-2025 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: add `GenDisk` private data support
Allow users of the rust block device driver API to install private data in the `GenDisk` structure.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Re
rust: block: add `GenDisk` private data support
Allow users of the rust block device driver API to install private data in the `GenDisk` structure.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250902-rnull-up-v6-16-v7-14-b5212cc89b98@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| 8c32697c | 02-Sep-2025 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: remove trait bound from `mq::Request` definition
Remove the trait bound `T:Operations` from `mq::Request`. The bound is not required, so remove it to reduce complexity.
Reviewed-by: Al
rust: block: remove trait bound from `mq::Request` definition
Remove the trait bound `T:Operations` from `mq::Request`. The bound is not required, so remove it to reduce complexity.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250902-rnull-up-v6-16-v7-10-b5212cc89b98@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| f52689fc | 02-Sep-2025 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: remove `RawWriter`
`RawWriter` is now dead code, so remove it.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by:
rust: block: remove `RawWriter`
`RawWriter` is now dead code, so remove it.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250902-rnull-up-v6-16-v7-9-b5212cc89b98@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
| c3a54220 | 02-Sep-2025 |
Andreas Hindborg <a.hindborg@kernel.org> |
rust: block: use `NullTerminatedFormatter`
Use the new `NullTerminatedFormatter` to write the name of a `GenDisk` to the name buffer. This new formatter automatically adds a trailing null marker aft
rust: block: use `NullTerminatedFormatter`
Use the new `NullTerminatedFormatter` to write the name of a `GenDisk` to the name buffer. This new formatter automatically adds a trailing null marker after the written characters, so we don't need to append that at the call site any longer.
Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250902-rnull-up-v6-16-v7-8-b5212cc89b98@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|