* [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1
@ 2026-09-29 9:33 Andreas Hindborg
2026-09-29 9:33 ` [PATCH GIT PULL 1/9] rust: block: mq: use vertical import style Andreas Hindborg
` (9 more replies)
0 siblings, 10 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:33 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Alvin Sun, stable,
Priya Bala Govindasamy <pgovind2@uci.edu>,
Dylan Zueck <dzueck@uci.edu>,
Yuan Tan, Sophon Z, Qingxiao Xu, Malte Wechter
Hi Jens,
I have a number of Rust block layer patches I would ask you to pick for
v7.4. I have collected them into a patch series as well as a pull request
so you can use whatever is easier.
The changes cover
- Style and formatting changes.
- Documentation fixes.
- Fixes for missing trait bounds that can cause API unsoundness.
- A change to set the owner of the file operations vtable in `GenDisk`.
- Two bug fixes for the rnull driver.
The following changes since commit df2908090cda368b01ff43709f51890076c56157:
Linux 7.3-rc2 (2026-09-06 15:07:20 -0700)
are available in the Git repository at:
https://github.com/rust-for-linux/linux.git tags/rust-block-for-v7.4-rc1
for you to fetch changes up to b6cfe408d16ecb68a8b10b0d738669aeaecbde6f:
rust: block: require `Sync` for `Operations::QueueData` (2026-09-29 11:23:27 +0200)
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
Alvin Sun (4):
rust: block: mq: use vertical import style
rust: block: mq: remove redundant imports and format
rust: block: rnull: use vertical import style
rust: block: gen_disk: set fops.owner from driver module pointer
Andreas Hindborg (2):
rust: block: fix `Send` bound for `GenDisk`
rust: block: require `Sync` for `Operations::QueueData`
Malte Wechter (1):
rnull: configfs: add power to configfs features
Qingxiao Xu (1):
rnull: fix geometry store check-then-act across lock scopes
Sophon Z (1):
rust: block: Fix GenDiskBuilder block size documentation
drivers/block/rnull/configfs.rs | 44 +++++++++++++++--------
drivers/block/rnull/rnull.rs | 15 +++++---
rust/kernel/block/mq/gen_disk.rs | 72 ++++++++++++++++++++------------------
rust/kernel/block/mq/operations.rs | 16 ++++++---
rust/kernel/block/mq/request.rs | 16 ++++++---
rust/kernel/block/mq/tag_set.rs | 28 +++++++--------
6 files changed, 115 insertions(+), 76 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260929-rust-block-for-v7-4-rc1-b4-6fac377c366c
Best regards,
--
Andreas Hindborg <a.hindborg@kernel.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 1/9] rust: block: mq: use vertical import style
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
@ 2026-09-29 9:33 ` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 2/9] rust: block: mq: remove redundant imports and format Andreas Hindborg
` (8 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:33 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Alvin Sun
From: Alvin Sun <alvin.sun@linux.dev>
Convert `use` imports to vertical layout for better readability and
maintainability.
Reviewed-by: Onur Özkan <work@onurozkan.dev>
Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
Link: https://msgid.link/20260521-miscdev-use-format-v3-4-56240ca70d0c@linux.dev
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
rust/kernel/block/mq/gen_disk.rs | 21 +++++++++++++++++----
rust/kernel/block/mq/operations.rs | 17 +++++++++++++----
rust/kernel/block/mq/request.rs | 14 ++++++++++----
rust/kernel/block/mq/tag_set.rs | 24 +++++++++++++++++++-----
4 files changed, 59 insertions(+), 17 deletions(-)
diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index fc97dd873974..31cc7a77c2b5 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -7,14 +7,27 @@
use crate::{
bindings,
- block::mq::{Operations, TagSet},
- error::{self, from_err_ptr, Result},
- fmt::{self, Write},
+ block::mq::{
+ Operations,
+ TagSet, //
+ },
+ error::{
+ self,
+ from_err_ptr,
+ Result, //
+ },
+ fmt::{
+ self,
+ Write, //
+ },
prelude::*,
static_lock_class,
str::NullTerminatedFormatter,
sync::Arc,
- types::{ForeignOwnable, ScopeGuard},
+ types::{
+ ForeignOwnable,
+ ScopeGuard, //
+ }, //
};
/// A builder for [`GenDisk`].
diff --git a/rust/kernel/block/mq/operations.rs b/rust/kernel/block/mq/operations.rs
index 861903e18fbf..64bcb31666c0 100644
--- a/rust/kernel/block/mq/operations.rs
+++ b/rust/kernel/block/mq/operations.rs
@@ -6,11 +6,20 @@
use crate::{
bindings,
- block::mq::{request::RequestDataWrapper, Request},
- error::{from_result, Result},
+ block::mq::{
+ request::RequestDataWrapper,
+ Request, //
+ },
+ error::{
+ from_result,
+ Result, //
+ },
prelude::*,
- sync::{aref::ARef, Refcount},
- types::ForeignOwnable,
+ sync::{
+ aref::ARef,
+ Refcount, //
+ },
+ types::ForeignOwnable, //
};
use core::marker::PhantomData;
diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
index ce3e30c81cb5..66254d02bba6 100644
--- a/rust/kernel/block/mq/request.rs
+++ b/rust/kernel/block/mq/request.rs
@@ -9,13 +9,19 @@
block::mq::Operations,
error::Result,
sync::{
- aref::{ARef, AlwaysRefCounted},
+ aref::{
+ ARef,
+ AlwaysRefCounted, //
+ },
atomic::Relaxed,
- Refcount,
+ Refcount, //
},
- types::Opaque,
+ types::Opaque, //
+};
+use core::{
+ marker::PhantomData,
+ ptr::NonNull, //
};
-use core::{marker::PhantomData, ptr::NonNull};
/// A wrapper around a blk-mq [`struct request`]. This represents an IO request.
///
diff --git a/rust/kernel/block/mq/tag_set.rs b/rust/kernel/block/mq/tag_set.rs
index dae9df408a86..c1fd3e047af5 100644
--- a/rust/kernel/block/mq/tag_set.rs
+++ b/rust/kernel/block/mq/tag_set.rs
@@ -8,13 +8,27 @@
use crate::{
bindings,
- block::mq::{operations::OperationsVTable, request::RequestDataWrapper, Operations},
- error::{self, Result},
+ block::mq::{
+ operations::OperationsVTable,
+ request::RequestDataWrapper,
+ Operations, //
+ },
+ error::{
+ self,
+ Result, //
+ },
prelude::try_pin_init,
- types::Opaque,
+ types::Opaque, //
+};
+use core::{
+ convert::TryInto,
+ marker::PhantomData, //
+};
+use pin_init::{
+ pin_data,
+ pinned_drop,
+ PinInit, //
};
-use core::{convert::TryInto, marker::PhantomData};
-use pin_init::{pin_data, pinned_drop, PinInit};
/// A wrapper for the C `struct blk_mq_tag_set`.
///
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 2/9] rust: block: mq: remove redundant imports and format
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
2026-09-29 9:33 ` [PATCH GIT PULL 1/9] rust: block: mq: use vertical import style Andreas Hindborg
@ 2026-09-29 9:34 ` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 3/9] rust: block: rnull: use vertical import style Andreas Hindborg
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:34 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Alvin Sun
From: Alvin Sun <alvin.sun@linux.dev>
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>
---
rust/kernel/block/mq/gen_disk.rs | 7 +++----
rust/kernel/block/mq/operations.rs | 5 +----
rust/kernel/block/mq/request.rs | 2 +-
rust/kernel/block/mq/tag_set.rs | 22 ++++------------------
4 files changed, 9 insertions(+), 27 deletions(-)
diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index 31cc7a77c2b5..8ec38a7b9815 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -12,9 +12,8 @@
TagSet, //
},
error::{
- self,
from_err_ptr,
- Result, //
+ to_result, //
},
fmt::{
self,
@@ -67,7 +66,7 @@ pub fn rotational(mut self, rotational: bool) -> Self {
/// and that it is a power of two.
pub fn validate_block_size(size: u32) -> Result {
if !(512..=bindings::PAGE_SIZE as u32).contains(&size) || !size.is_power_of_two() {
- Err(error::code::EINVAL)
+ Err(EINVAL)
} else {
Ok(())
}
@@ -190,7 +189,7 @@ pub fn build<T: Operations>(
// operation, so we will not race.
unsafe { bindings::set_capacity(gendisk, self.capacity_sectors) };
- crate::error::to_result(
+ to_result(
// SAFETY: `gendisk` points to a valid and initialized instance of
// `struct gendisk`.
unsafe {
diff --git a/rust/kernel/block/mq/operations.rs b/rust/kernel/block/mq/operations.rs
index 64bcb31666c0..b9ab0e6102a4 100644
--- a/rust/kernel/block/mq/operations.rs
+++ b/rust/kernel/block/mq/operations.rs
@@ -10,10 +10,7 @@
request::RequestDataWrapper,
Request, //
},
- error::{
- from_result,
- Result, //
- },
+ error::from_result,
prelude::*,
sync::{
aref::ARef,
diff --git a/rust/kernel/block/mq/request.rs b/rust/kernel/block/mq/request.rs
index 66254d02bba6..6115f9aec228 100644
--- a/rust/kernel/block/mq/request.rs
+++ b/rust/kernel/block/mq/request.rs
@@ -7,7 +7,7 @@
use crate::{
bindings,
block::mq::Operations,
- error::Result,
+ prelude::*,
sync::{
aref::{
ARef,
diff --git a/rust/kernel/block/mq/tag_set.rs b/rust/kernel/block/mq/tag_set.rs
index c1fd3e047af5..df3f90bfbb81 100644
--- a/rust/kernel/block/mq/tag_set.rs
+++ b/rust/kernel/block/mq/tag_set.rs
@@ -4,8 +4,6 @@
//!
//! C header: [`include/linux/blk-mq.h`](srctree/include/linux/blk-mq.h)
-use core::pin::Pin;
-
use crate::{
bindings,
block::mq::{
@@ -13,22 +11,14 @@
request::RequestDataWrapper,
Operations, //
},
- error::{
- self,
- Result, //
- },
- prelude::try_pin_init,
+ error::to_result,
+ prelude::*,
types::Opaque, //
};
use core::{
convert::TryInto,
marker::PhantomData, //
};
-use pin_init::{
- pin_data,
- pinned_drop,
- PinInit, //
-};
/// A wrapper for the C `struct blk_mq_tag_set`.
///
@@ -47,11 +37,7 @@ pub struct TagSet<T: Operations> {
impl<T: Operations> TagSet<T> {
/// Try to create a new tag set
- pub fn new(
- nr_hw_queues: u32,
- num_tags: u32,
- num_maps: u32,
- ) -> impl PinInit<Self, error::Error> {
+ pub fn new(nr_hw_queues: u32, num_tags: u32, num_maps: u32) -> impl PinInit<Self, Error> {
let tag_set: bindings::blk_mq_tag_set = pin_init::zeroed();
let tag_set: Result<_> = core::mem::size_of::<RequestDataWrapper>()
.try_into()
@@ -77,7 +63,7 @@ pub fn new(
// SAFETY: we do not move out of `tag_set`.
let tag_set: &mut Opaque<_> = unsafe { Pin::get_unchecked_mut(tag_set) };
// SAFETY: `tag_set` is a reference to an initialized `blk_mq_tag_set`.
- error::to_result( unsafe { bindings::blk_mq_alloc_tag_set(tag_set.get())})
+ to_result( unsafe { bindings::blk_mq_alloc_tag_set(tag_set.get())})
}),
_p: PhantomData,
})
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 3/9] rust: block: rnull: use vertical import style
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
2026-09-29 9:33 ` [PATCH GIT PULL 1/9] rust: block: mq: use vertical import style Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 2/9] rust: block: mq: remove redundant imports and format Andreas Hindborg
@ 2026-09-29 9:34 ` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 4/9] rust: block: fix `Send` bound for `GenDisk` Andreas Hindborg
` (6 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:34 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Alvin Sun
From: Alvin Sun <alvin.sun@linux.dev>
Convert `use` imports to vertical layout for better readability and
maintainability.
Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
Link: https://msgid.link/20260521-miscdev-use-format-v3-6-56240ca70d0c@linux.dev
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
drivers/block/rnull/configfs.rs | 22 +++++++++++++++++-----
drivers/block/rnull/rnull.rs | 15 +++++++++++----
2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/drivers/block/rnull/configfs.rs b/drivers/block/rnull/configfs.rs
index 32c10c3f4d0f..9b28be215093 100644
--- a/drivers/block/rnull/configfs.rs
+++ b/drivers/block/rnull/configfs.rs
@@ -2,15 +2,27 @@
use super::NullBlkDevice;
use kernel::{
- block::mq::gen_disk::{GenDisk, GenDiskBuilder},
- configfs::{self, AttributeOperations},
+ block::mq::gen_disk::{
+ GenDisk,
+ GenDiskBuilder, //
+ },
+ configfs::{
+ self,
+ AttributeOperations, //
+ },
configfs_attrs,
- fmt::{self, Write as _},
+ fmt::{
+ self,
+ Write as _, //
+ },
new_mutex,
page::PAGE_SIZE,
prelude::*,
- str::{kstrtobool_bytes, CString},
- sync::Mutex,
+ str::{
+ kstrtobool_bytes,
+ CString, //
+ },
+ sync::Mutex, //
};
pub(crate) fn subsystem() -> impl PinInit<kernel::configfs::Subsystem<Config>, Error> {
diff --git a/drivers/block/rnull/rnull.rs b/drivers/block/rnull/rnull.rs
index 0ca8715febe8..13048cea8bb0 100644
--- a/drivers/block/rnull/rnull.rs
+++ b/drivers/block/rnull/rnull.rs
@@ -10,12 +10,19 @@
self,
mq::{
self,
- gen_disk::{self, GenDisk},
- Operations, TagSet,
- },
+ gen_disk::{
+ self,
+ GenDisk, //
+ },
+ Operations,
+ TagSet, //
+ }, //
},
prelude::*,
- sync::{aref::ARef, Arc},
+ sync::{
+ aref::ARef,
+ Arc, //
+ }, //
};
module! {
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 4/9] rust: block: fix `Send` bound for `GenDisk`
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
` (2 preceding siblings ...)
2026-09-29 9:34 ` [PATCH GIT PULL 3/9] rust: block: rnull: use vertical import style Andreas Hindborg
@ 2026-09-29 9:34 ` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 5/9] rust: block: gen_disk: set fops.owner from driver module pointer Andreas Hindborg
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:34 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, stable,
Priya Bala Govindasamy <pgovind2@uci.edu>,
Dylan Zueck <dzueck@uci.edu>,
Yuan Tan, Yuan Tan
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>
---
rust/kernel/block/mq/gen_disk.rs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index 8ec38a7b9815..080dedb5d5d9 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -224,8 +224,14 @@ pub struct GenDisk<T: Operations> {
}
// SAFETY: `GenDisk` is an owned pointer to a `struct gendisk` and an `Arc` to a
-// `TagSet` It is safe to send this to other threads as long as T is Send.
-unsafe impl<T: Operations + Send> Send for GenDisk<T> {}
+// `TagSet`. It is safe to send this to other threads as long as these two are `Send`.
+unsafe impl<T> Send for GenDisk<T>
+where
+ T: Operations,
+ T::QueueData: Send,
+ Arc<TagSet<T>>: Send,
+{
+}
impl<T: Operations> Drop for GenDisk<T> {
fn drop(&mut self) {
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 5/9] rust: block: gen_disk: set fops.owner from driver module pointer
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
` (3 preceding siblings ...)
2026-09-29 9:34 ` [PATCH GIT PULL 4/9] rust: block: fix `Send` bound for `GenDisk` Andreas Hindborg
@ 2026-09-29 9:34 ` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 6/9] rust: block: Fix GenDiskBuilder block size documentation Andreas Hindborg
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:34 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Alvin Sun
From: Alvin Sun <alvin.sun@linux.dev>
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>
---
rust/kernel/block/mq/gen_disk.rs | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index 080dedb5d5d9..90d364ab3bf2 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -137,30 +137,9 @@ pub fn build<T: Operations>(
)
})?;
- const TABLE: bindings::block_device_operations = bindings::block_device_operations {
- submit_bio: None,
- open: None,
- release: None,
- ioctl: None,
- compat_ioctl: None,
- check_events: None,
- unlock_native_capacity: None,
- getgeo: None,
- set_read_only: None,
- swap_slot_free_notify: None,
- report_zones: None,
- devnode: None,
- alternative_gpt_sector: None,
- get_unique_id: None,
- // TODO: Set to `THIS_MODULE`.
- owner: core::ptr::null_mut(),
- pr_ops: core::ptr::null_mut(),
- free_disk: None,
- poll_bio: None,
- };
-
- // SAFETY: `gendisk` is a valid pointer as we initialized it above
- unsafe { (*gendisk).fops = &TABLE };
+ // SAFETY: `gendisk` is a valid pointer. We have exclusive access,
+ // since the disk is not added to the VFS yet.
+ unsafe { (*gendisk).fops = &GenDisk::<T>::VTABLE };
let cleanup_failure = ScopeGuard::new_with_data((gendisk, data), |(gendisk, data)| {
// SAFETY: `gendisk` came from `__blk_mq_alloc_disk()` above and
@@ -223,6 +202,13 @@ pub struct GenDisk<T: Operations> {
gendisk: *mut bindings::gendisk,
}
+impl<T: Operations> GenDisk<T> {
+ const VTABLE: bindings::block_device_operations = bindings::block_device_operations {
+ owner: crate::module::this_module::<T::OwnerModule>().as_ptr(),
+ ..pin_init::zeroed()
+ };
+}
+
// SAFETY: `GenDisk` is an owned pointer to a `struct gendisk` and an `Arc` to a
// `TagSet`. It is safe to send this to other threads as long as these two are `Send`.
unsafe impl<T> Send for GenDisk<T>
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 6/9] rust: block: Fix GenDiskBuilder block size documentation
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
` (4 preceding siblings ...)
2026-09-29 9:34 ` [PATCH GIT PULL 5/9] rust: block: gen_disk: set fops.owner from driver module pointer Andreas Hindborg
@ 2026-09-29 9:34 ` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 7/9] rnull: fix geometry store check-then-act across lock scopes Andreas Hindborg
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:34 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Sophon Z
From: Sophon Z <aiqubits@hotmail.com>
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>
---
rust/kernel/block/mq/gen_disk.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index 90d364ab3bf2..0fe640f3aec6 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -75,7 +75,7 @@ pub fn validate_block_size(size: u32) -> Result {
/// Set the logical block size of the device to be built.
///
/// This method will check that block size is a power of two and between 512
- /// and 4096. If not, an error is returned and the block size is not set.
+ /// and `PAGE_SIZE`. If not, an error is returned and the block size is not set.
///
/// This is the smallest unit the storage device can address. It is
/// typically 4096 bytes.
@@ -88,7 +88,7 @@ pub fn logical_block_size(mut self, block_size: u32) -> Result<Self> {
/// Set the physical block size of the device to be built.
///
/// This method will check that block size is a power of two and between 512
- /// and 4096. If not, an error is returned and the block size is not set.
+ /// and `PAGE_SIZE`. If not, an error is returned and the block size is not set.
///
/// This is the smallest unit a physical storage device can write
/// atomically. It is usually the same as the logical block size but may be
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 7/9] rnull: fix geometry store check-then-act across lock scopes
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
` (5 preceding siblings ...)
2026-09-29 9:34 ` [PATCH GIT PULL 6/9] rust: block: Fix GenDiskBuilder block size documentation Andreas Hindborg
@ 2026-09-29 9:34 ` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 8/9] rnull: configfs: add power to configfs features Andreas Hindborg
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:34 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Qingxiao Xu
From: Qingxiao Xu <qingxiao@tamu.edu>
The blocksize/rotational/capacity/irqmode stores check powered under one
Mutex acquisition, drop the guard, then update under a second acquisition.
A concurrent power-on can create the live disk from stale geometry in
between, leaving powered==true with config != live disk.
Hold one guard for the powered check and the field update.
Signed-off-by: Qingxiao Xu <qingxiao@tamu.edu>
Link: https://msgid.link/20260908200845.405112-1-qingxiao@tamu.edu
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
drivers/block/rnull/configfs.rs | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/block/rnull/configfs.rs b/drivers/block/rnull/configfs.rs
index 9b28be215093..24b02256b4cd 100644
--- a/drivers/block/rnull/configfs.rs
+++ b/drivers/block/rnull/configfs.rs
@@ -186,7 +186,8 @@ impl configfs::AttributeOperations<1> for DeviceConfig {
}
fn store(this: &DeviceConfig, page: &[u8]) -> Result {
- if this.data.lock().powered {
+ let mut guard = this.data.lock();
+ if guard.powered {
return Err(EBUSY);
}
@@ -194,7 +195,7 @@ fn store(this: &DeviceConfig, page: &[u8]) -> Result {
let value = text.parse::<u32>().map_err(|_| EINVAL)?;
GenDiskBuilder::validate_block_size(value)?;
- this.data.lock().block_size = value;
+ guard.block_size = value;
Ok(())
}
}
@@ -216,11 +217,12 @@ impl configfs::AttributeOperations<2> for DeviceConfig {
}
fn store(this: &DeviceConfig, page: &[u8]) -> Result {
- if this.data.lock().powered {
+ let mut guard = this.data.lock();
+ if guard.powered {
return Err(EBUSY);
}
- this.data.lock().rotational = kstrtobool_bytes(page)?;
+ guard.rotational = kstrtobool_bytes(page)?;
Ok(())
}
@@ -237,14 +239,15 @@ impl configfs::AttributeOperations<3> for DeviceConfig {
}
fn store(this: &DeviceConfig, page: &[u8]) -> Result {
- if this.data.lock().powered {
+ let mut guard = this.data.lock();
+ if guard.powered {
return Err(EBUSY);
}
let text = core::str::from_utf8(page)?.trim();
let value = text.parse::<u64>().map_err(|_| EINVAL)?;
- this.data.lock().capacity_mib = value;
+ guard.capacity_mib = value;
Ok(())
}
}
@@ -260,14 +263,15 @@ impl configfs::AttributeOperations<4> for DeviceConfig {
}
fn store(this: &DeviceConfig, page: &[u8]) -> Result {
- if this.data.lock().powered {
+ let mut guard = this.data.lock();
+ if guard.powered {
return Err(EBUSY);
}
let text = core::str::from_utf8(page)?.trim();
let value = text.parse::<u8>().map_err(|_| EINVAL)?;
- this.data.lock().irq_mode = IRQMode::try_from(value)?;
+ guard.irq_mode = IRQMode::try_from(value)?;
Ok(())
}
}
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 8/9] rnull: configfs: add power to configfs features
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
` (6 preceding siblings ...)
2026-09-29 9:34 ` [PATCH GIT PULL 7/9] rnull: fix geometry store check-then-act across lock scopes Andreas Hindborg
@ 2026-09-29 9:34 ` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 9/9] rust: block: require `Sync` for `Operations::QueueData` Andreas Hindborg
2026-09-29 11:47 ` [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Jens Axboe
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:34 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Malte Wechter
From: Malte Wechter <maltewechter@gmail.com>
features displayed by configfs for rnull was inconsistent with the
actual features available. This correctly exposes `power` as a feature,
which is also consistent with the C null_blk driver.
Fixes: d969d504bc13 ("rnull: enable configuration via `configfs`")
Signed-off-by: Malte Wechter <maltewechter@gmail.com>
Link: https://msgid.link/20260924-upstream-v7-3-rc3-v2-1-ca56ae7a73e9@gmail.com
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
drivers/block/rnull/configfs.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/rnull/configfs.rs b/drivers/block/rnull/configfs.rs
index 24b02256b4cd..34ef96fa125f 100644
--- a/drivers/block/rnull/configfs.rs
+++ b/drivers/block/rnull/configfs.rs
@@ -47,7 +47,7 @@ impl AttributeOperations<0> for Config {
fn show(_this: &Config, page: &mut [u8; PAGE_SIZE]) -> Result<usize> {
let mut writer = kernel::str::Formatter::new(page);
- writer.write_str("blocksize,size,rotational,irqmode\n")?;
+ writer.write_str("blocksize,size,rotational,irqmode,power\n")?;
Ok(writer.bytes_written())
}
}
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH GIT PULL 9/9] rust: block: require `Sync` for `Operations::QueueData`
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
` (7 preceding siblings ...)
2026-09-29 9:34 ` [PATCH GIT PULL 8/9] rnull: configfs: add power to configfs features Andreas Hindborg
@ 2026-09-29 9:34 ` Andreas Hindborg
2026-09-29 11:47 ` [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Jens Axboe
9 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-29 9:34 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, stable
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>
---
rust/kernel/block/mq/operations.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/kernel/block/mq/operations.rs b/rust/kernel/block/mq/operations.rs
index b9ab0e6102a4..08111d8368eb 100644
--- a/rust/kernel/block/mq/operations.rs
+++ b/rust/kernel/block/mq/operations.rs
@@ -36,7 +36,7 @@
pub trait Operations: Sized {
/// Data associated with the `struct request_queue` that is allocated for
/// the `GenDisk` associated with this `Operations` implementation.
- type QueueData: ForeignOwnable;
+ type QueueData: ForeignOwnable + Sync;
/// Called by the kernel to queue a request with the driver. If `is_last` is
/// `false`, the driver is allowed to defer committing the request.
--
2.54.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
` (8 preceding siblings ...)
2026-09-29 9:34 ` [PATCH GIT PULL 9/9] rust: block: require `Sync` for `Operations::QueueData` Andreas Hindborg
@ 2026-09-29 11:47 ` Jens Axboe
2026-09-30 15:06 ` Thorsten Leemhuis
9 siblings, 1 reply; 15+ messages in thread
From: Jens Axboe @ 2026-09-29 11:47 UTC (permalink / raw)
To: Andreas Hindborg
Cc: Boqun Feng, Miguel Ojeda, Gary Guo, Björn Roy Baron,
Benno Lossin, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan, linux-block, rust-for-linux, linux-kernel,
Alvin Sun, stable,
Priya Bala Govindasamy <pgovind2@uci.edu>,
Dylan Zueck <dzueck@uci.edu>,
Yuan Tan, Sophon Z, Qingxiao Xu, Malte Wechter
On Tue, 29 Sep 2026 11:33:58 +0200, Andreas Hindborg wrote:
> I have a number of Rust block layer patches I would ask you to pick for
> v7.4. I have collected them into a patch series as well as a pull request
> so you can use whatever is easier.
>
> The changes cover
>
> - Style and formatting changes.
> - Documentation fixes.
> - Fixes for missing trait bounds that can cause API unsoundness.
> - A change to set the owner of the file operations vtable in `GenDisk`.
> - Two bug fixes for the rnull driver.
>
> [...]
Applied, thanks!
[1/9] rust: block: mq: use vertical import style
commit: 020185c5f4a5590267b825dffda05eb5d45dfa5f
[2/9] rust: block: mq: remove redundant imports and format
commit: 06e75dbe894f260651627c35e0f36536c4894536
[3/9] rust: block: rnull: use vertical import style
commit: a463f71c492336f9650bae7d7166b66ee87461e9
[4/9] rust: block: fix `Send` bound for `GenDisk`
commit: e502b667ee70a7fa2a578e7722672ecd4fe0eb81
[5/9] rust: block: gen_disk: set fops.owner from driver module pointer
commit: 67a11f2e076016f054dc4a4a637d9b37530b7908
[6/9] rust: block: Fix GenDiskBuilder block size documentation
commit: c595572d0e49c79fcefe8db8e3e4f4e6e1fab734
[7/9] rnull: fix geometry store check-then-act across lock scopes
commit: 7ac697d4a08f01e7aefdeb1f3e1d6f71b2cdac0d
[8/9] rnull: configfs: add power to configfs features
commit: 0cd698e89375d0dfc257f9ae978420aa7fe5359d
[9/9] rust: block: require `Sync` for `Operations::QueueData`
commit: 67b7a2728e4873e64405c5564fe50f7123012b71
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1
2026-09-29 11:47 ` [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Jens Axboe
@ 2026-09-30 15:06 ` Thorsten Leemhuis
2026-09-30 15:25 ` Miguel Ojeda
2026-09-30 15:31 ` Gary Guo
0 siblings, 2 replies; 15+ messages in thread
From: Thorsten Leemhuis @ 2026-09-30 15:06 UTC (permalink / raw)
To: Jens Axboe, Andreas Hindborg
Cc: Boqun Feng, Miguel Ojeda, Gary Guo, Björn Roy Baron,
Benno Lossin, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan, linux-block, rust-for-linux, linux-kernel,
Alvin Sun, stable, Priya Bala Govindasamy, Dylan Zueck, Yuan Tan,
Sophon Z, Qingxiao Xu, Malte Wechter, Mark Brown,
Linux kernel regressions list, Linux Next Mailing List
On 9/29/26 13:47, Jens Axboe wrote:
> On Tue, 29 Sep 2026 11:33:58 +0200, Andreas Hindborg wrote:
>> I have a number of Rust block layer patches I would ask you to pick for
>> v7.4. I have collected them into a patch series as well as a pull request
>> so you can use whatever is easier.
>>
>> The changes cover
>>
>> - Style and formatting changes.
>> - Documentation fixes.
>> - Fixes for missing trait bounds that can cause API unsoundness.
>> - A change to set the owner of the file operations vtable in `GenDisk`.
>> - Two bug fixes for the rnull driver.
>>
>> [...]
>
> Applied, thanks!
> [...]
This series showed up in next today and broke the build for me on
various Fedora releases for aarch64 and x86_64; reverting this series
fixed that from a quick build test limited to drivers/block/rnull/
The full error msg is quote long, find the top of it below. Full log:
https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-aarch64/11055137-next-next-all/builder-live.log.gz
Ciao, Thorsten
"""
> error[E0277]: `UnsafeCell<MaybeUninit<blk_mq_tag_set>>` cannot be shared between threads safely
> --> drivers/block/rnull/configfs.rs:57:18
> |
> 57 | type Child = DeviceConfig;
> | ^^^^^^^^^^^^ `UnsafeCell<MaybeUninit<blk_mq_tag_set>>` cannot be shared between threads safely
> |
> = help: within `TagSet<NullBlkDevice>`, the trait `Sync` is not implemented for `UnsafeCell<MaybeUninit<blk_mq_tag_set>>`
> note: required because it appears within the type `Opaque<blk_mq_tag_set>`
> --> rust/kernel/types.rs:332:12
> |
> 332 | pub struct Opaque<T> {
> | ^^^^^^
> note: required because it appears within the type `TagSet<NullBlkDevice>`
> --> rust/kernel/block/mq/tag_set.rs:32:12
> |
> 32 | pub struct TagSet<T: Operations> {
> | ^^^^^^
> = note: required for `Arc<TagSet<NullBlkDevice>>` to implement `Send`
> = note: 1 redundant requirement hidden
> = note: required for `GenDisk<NullBlkDevice>` to implement `Send`
> note: required because it appears within the type `Option<GenDisk<NullBlkDevice>>`
> --> /usr/lib/rustlib/src/rust/library/core/src/option.rs:598:10
> |
> 598 | pub enum Option<T> {
> | ^^^^^^
> note: required because it appears within the type `DeviceConfigInner`
> --> drivers/block/rnull/configfs.rs:130:8
> |
> 130 | struct DeviceConfigInner {
> | ^^^^^^^^^^^^^^^^^
> = note: required for `Lock<DeviceConfigInner, MutexBackend>` to implement `Send`
> note: required because it appears within the type `DeviceConfig`
> --> drivers/block/rnull/configfs.rs:124:19
> |
> 124 | pub(crate) struct DeviceConfig {
> | ^^^^^^^^^^^^
> note: required by a bound in `kernel::configfs::GroupOperations::Child`
> --> rust/kernel/configfs.rs:518:27
> |
> 518 | type Child: 'static + Send;
> | ^^^^ required by this bound in `GroupOperations::Child`
>
> error[E0277]: `*const blk_mq_ops` cannot be sent between threads safely
> --> drivers/block/rnull/configfs.rs:57:18
> |
> 57 | type Child = DeviceConfig;
> | ^^^^^^^^^^^^ `*const blk_mq_ops` cannot be sent between threads safely
> |
> = help: within `TagSet<NullBlkDevice>`, the trait `Send` is not implemented for `*const blk_mq_ops`
> note: required because it appears within the type `blk_mq_tag_set`
> --> /builddir/build/BUILD/kernel-7.3.0-build/kernel-next-20260930/linux-7.3.0-0.0.next.20260930.545.vanilla.fc46.aarch64/rust/bindings/bindings_generated.rs:105198:12
> |
> 105198 | pub struct blk_mq_tag_set {
> | ^^^^^^^^^^^^^^
> note: required because it appears within the type `MaybeDangling<blk_mq_tag_set>`
> --> /usr/lib/rustlib/src/rust/library/core/src/mem/maybe_dangling.rs:73:12
> |
> 73 | pub struct MaybeDangling<P: ?Sized>(P);
> [...]"""
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1
2026-09-30 15:06 ` Thorsten Leemhuis
@ 2026-09-30 15:25 ` Miguel Ojeda
2026-09-30 15:31 ` Gary Guo
1 sibling, 0 replies; 15+ messages in thread
From: Miguel Ojeda @ 2026-09-30 15:25 UTC (permalink / raw)
To: Thorsten Leemhuis
Cc: Jens Axboe, Andreas Hindborg, Boqun Feng, Miguel Ojeda, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, linux-block, rust-for-linux,
linux-kernel, Alvin Sun, stable, Priya Bala Govindasamy,
Dylan Zueck, Yuan Tan, Sophon Z, Qingxiao Xu, Malte Wechter,
Mark Brown, Linux kernel regressions list,
Linux Next Mailing List
On Wed, Sep 30, 2026 at 5:07 PM Thorsten Leemhuis <linux@leemhuis.info> wrote:
>
> This series showed up in next today and broke the build for me on
> various Fedora releases for aarch64 and x86_64; reverting this series
> fixed that from a quick build test limited to drivers/block/rnull/
>
> The full error msg is quote long, find the top of it below. Full log:
> https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-aarch64/11055137-next-next-all/builder-live.log.gz
Confirmed, I see it e.g. in my arm32 build.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1
2026-09-30 15:06 ` Thorsten Leemhuis
2026-09-30 15:25 ` Miguel Ojeda
@ 2026-09-30 15:31 ` Gary Guo
2026-09-30 19:49 ` Andreas Hindborg
1 sibling, 1 reply; 15+ messages in thread
From: Gary Guo @ 2026-09-30 15:31 UTC (permalink / raw)
To: Thorsten Leemhuis, Jens Axboe, Andreas Hindborg
Cc: Boqun Feng, Miguel Ojeda, Gary Guo, Björn Roy Baron,
Benno Lossin, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan, linux-block, rust-for-linux, linux-kernel,
Alvin Sun, stable, Priya Bala Govindasamy, Dylan Zueck, Yuan Tan,
Sophon Z, Qingxiao Xu, Malte Wechter, Mark Brown,
Linux kernel regressions list, Linux Next Mailing List
On Wed Sep 30, 2026 at 4:06 PM BST, Thorsten Leemhuis wrote:
> On 9/29/26 13:47, Jens Axboe wrote:
>> On Tue, 29 Sep 2026 11:33:58 +0200, Andreas Hindborg wrote:
>>> I have a number of Rust block layer patches I would ask you to pick for
>>> v7.4. I have collected them into a patch series as well as a pull request
>>> so you can use whatever is easier.
>>>
>>> The changes cover
>>>
>>> - Style and formatting changes.
>>> - Documentation fixes.
>>> - Fixes for missing trait bounds that can cause API unsoundness.
>>> - A change to set the owner of the file operations vtable in `GenDisk`.
>>> - Two bug fixes for the rnull driver.
>>>
>>> [...]
>>
>> Applied, thanks!
>> [...]
>
> This series showed up in next today and broke the build for me on
> various Fedora releases for aarch64 and x86_64; reverting this series
> fixed that from a quick build test limited to drivers/block/rnull/
>
> The full error msg is quote long, find the top of it below. Full log:
> https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-aarch64/11055137-next-next-all/builder-live.log.gz
The `Child: Send` bound is introduced in configfs:
https://lore.kernel.org/all/tencent_05937A22D2DA2BAE808EF19E491AA109BC09@qq.com/.
So this is more or less a semantic conflict.
However, the fundamental issue is that TagSet never implements Send/Sync, which
means that "rust: block: fix `Send` bound for `GenDisk`" will unconditionally
strip away the Send implementation, which is problematic.
Something like this should fix the issue:
unsafe impl<T: Operations<QueueData: Send>> Send for TagSet<T> {}
unsafe impl<T: Operations<QueueData: Send>> Sync for TagSet<T> {}
That said, I am not sure why the GenDisk need to carry `Arc<TagSet<T>>: Send`
bound in the first place. Removing it should also fix the issue.
Also, the `QueueData: Send` bound should be part of the `Operations` trait and
not carried around everywhere.
Best,
Gary
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1
2026-09-30 15:31 ` Gary Guo
@ 2026-09-30 19:49 ` Andreas Hindborg
0 siblings, 0 replies; 15+ messages in thread
From: Andreas Hindborg @ 2026-09-30 19:49 UTC (permalink / raw)
To: Gary Guo, Thorsten Leemhuis, Jens Axboe
Cc: Boqun Feng, Miguel Ojeda, Gary Guo, Björn Roy Baron,
Benno Lossin, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan, linux-block, rust-for-linux, linux-kernel,
Alvin Sun, stable, Priya Bala Govindasamy, Dylan Zueck, Yuan Tan,
Sophon Z, Qingxiao Xu, Malte Wechter, Mark Brown,
Linux kernel regressions list, Linux Next Mailing List
"Gary Guo" <gary@garyguo.net> writes:
> On Wed Sep 30, 2026 at 4:06 PM BST, Thorsten Leemhuis wrote:
>> On 9/29/26 13:47, Jens Axboe wrote:
>>> On Tue, 29 Sep 2026 11:33:58 +0200, Andreas Hindborg wrote:
>>>> I have a number of Rust block layer patches I would ask you to pick for
>>>> v7.4. I have collected them into a patch series as well as a pull request
>>>> so you can use whatever is easier.
>>>>
>>>> The changes cover
>>>>
>>>> - Style and formatting changes.
>>>> - Documentation fixes.
>>>> - Fixes for missing trait bounds that can cause API unsoundness.
>>>> - A change to set the owner of the file operations vtable in `GenDisk`.
>>>> - Two bug fixes for the rnull driver.
>>>>
>>>> [...]
>>>
>>> Applied, thanks!
>>> [...]
>>
>> This series showed up in next today and broke the build for me on
>> various Fedora releases for aarch64 and x86_64; reverting this series
>> fixed that from a quick build test limited to drivers/block/rnull/
>>
>> The full error msg is quote long, find the top of it below. Full log:
>> https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-aarch64/11055137-next-next-all/builder-live.log.gz
>
> The `Child: Send` bound is introduced in configfs:
> https://lore.kernel.org/all/tencent_05937A22D2DA2BAE808EF19E491AA109BC09@qq.com/.
> So this is more or less a semantic conflict.
I did not consider the interactions of the two trees together. Good
thing we have linux-next.
> However, the fundamental issue is that TagSet never implements Send/Sync, which
> means that "rust: block: fix `Send` bound for `GenDisk`" will unconditionally
> strip away the Send implementation, which is problematic.
>
> Something like this should fix the issue:
>
> unsafe impl<T: Operations<QueueData: Send>> Send for TagSet<T> {}
> unsafe impl<T: Operations<QueueData: Send>> Sync for TagSet<T> {}
>
> That said, I am not sure why the GenDisk need to carry `Arc<TagSet<T>>: Send`
> bound in the first place. Removing it should also fix the issue.
`GenDisk<T>` has a field of type `Arc<TagSet<T>>`, so for `GenDisk` to be
send, so must `Arc<TagSet<T>>`. That `Arc` may be dropped with the
`GenDisk` if it is the last reference.
> Also, the `QueueData: Send` bound should be part of the `Operations` trait and
> not carried around everywhere.
`QueueData` is not involved here. An unconditional implementation is
fine. I submitted a patch here [1], hopefully Jens can pick it soon so
next can be unbroken tomorrow.
Best regards,
Andreas Hindborg
[1] https://lore.kernel.org/r/20260930-tag-set-send-sync-v1-1-51acdb36f4bb@kernel.org
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-09-30 19:50 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 9:33 [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Andreas Hindborg
2026-09-29 9:33 ` [PATCH GIT PULL 1/9] rust: block: mq: use vertical import style Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 2/9] rust: block: mq: remove redundant imports and format Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 3/9] rust: block: rnull: use vertical import style Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 4/9] rust: block: fix `Send` bound for `GenDisk` Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 5/9] rust: block: gen_disk: set fops.owner from driver module pointer Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 6/9] rust: block: Fix GenDiskBuilder block size documentation Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 7/9] rnull: fix geometry store check-then-act across lock scopes Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 8/9] rnull: configfs: add power to configfs features Andreas Hindborg
2026-09-29 9:34 ` [PATCH GIT PULL 9/9] rust: block: require `Sync` for `Operations::QueueData` Andreas Hindborg
2026-09-29 11:47 ` [GIT PULL PATCH 0/9] Rust changes for v7.4-rc1 Jens Axboe
2026-09-30 15:06 ` Thorsten Leemhuis
2026-09-30 15:25 ` Miguel Ojeda
2026-09-30 15:31 ` Gary Guo
2026-09-30 19:49 ` Andreas Hindborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®