`GenDisk` is a pointer to a `struct gendisk`. It is safe to reference this struct from multiple threads. Signed-off-by: Andreas Hindborg --- rust/kernel/block/mq/gen_disk.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs index 2b204b0ed49a..94af85fe1716 100644 --- a/rust/kernel/block/mq/gen_disk.rs +++ b/rust/kernel/block/mq/gen_disk.rs @@ -234,6 +234,17 @@ unsafe impl Send for GenDisk { } +// SAFETY: `GenDisk` is an owned pointer to a `struct gendisk` and an `Arc` to a `TagSet`. It is +// safe to reference these from multiple threads if the `Arc` and the `gendisk` private data is +// `Sync`. +unsafe impl Sync for GenDisk +where + T: Operations, + T::QueueData: Sync, + Arc>: Sync, +{ +} + impl Drop for GenDisk { fn drop(&mut self) { // SAFETY: By type invariant of `Self`, `self.gendisk` points to a valid -- 2.51.2