From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BBDA30C629 for ; Wed, 10 Jun 2026 07:08:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781075299; cv=none; b=MyuuxyJUCve3Sh2CvavudyO/gDZqC8J2mZ1gqqmjh5w2XRRM6lP1Vttxqw3NUIr0IpF3+vtgbtc4yta7rX3wXl6VZvGCaKUodzZB9wfKzvfW0hQeN7gzxOsnzUmjzBDbCA/vSDzMZGlD/fMyOI4V8lyaldeOYyBjnlOPQVg+nSU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781075299; c=relaxed/simple; bh=TFiWa1rmDutUcjN10SiRILNiRj4mDgrPIXrEwbSEiIM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BAqCojDebW1N2U0BcA3bKwQv6v5nCEuDpMPxmA5akC6p6BMNKYzGWgqcQluK8svqFB+I94UgBQrPLAZJZ79+CLu3u4L6Qs8IByNclDAXzvYP2xJIgFHuMgsaPX2n5Eqdx5d4YqkkVHDcYUUK51Dtv4EFRWDhvn52Lq0z4vN2Ix8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dd0k9nyG; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dd0k9nyG" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-490b37e1f47so55724645e9.0 for ; Wed, 10 Jun 2026 00:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781075295; x=1781680095; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=y2yBT45LsQrwZS6wwOfSrpTFpnj8Zde3n5eqn2ah4Ag=; b=dd0k9nyGupG1NITO0Qgek6H/aM9qRbJ+KhnqDatLEnkpIrfvQl0DBHXM8WWpUFz0x1 jE0YuUYggeKuenldzoY7LmkeS8a0CyHRZceEU7pN3UFIMnDAJRQRc5SvKfvLKj0frlYH SFA6DEoqwF0ae1U7Ste3lTpvWDGi2hwlKVuM5cGi9K+Mi+EjBCk3di1I+yYmLbPul9mx dpdSbsEikK8r+4cj/XVDghtlafxg/h0s4c/Pcra9UzlksvqnnjFms9R+Ggyeb+yDkX2b JEaTBCOcHfGuYeC/JCOube0mrvTf3DzVLekgLGmX7zegt3iTveA8UPQGpdWeAOi1Df5M 45Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781075295; x=1781680095; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y2yBT45LsQrwZS6wwOfSrpTFpnj8Zde3n5eqn2ah4Ag=; b=VeOWBTZ2JeVrkbckPiNMpQVmGOzVPtVGsQReeypZSnUCoH86BGbMC6qGqhDEfA7EDD jHXWG63T+lJp13bKwCqnxJFk9+JPssIAIhB+AqrUFoFS9LCSF2qObgbFOM6pWd6ul7dS siDXa44R2KZ4S2j/NR5DGTxIgS5cj6n9r+kk8yL73TqCXWADLcG/v74bGtTx3V2NN0ml 4it0WftgqBTP9cWYGqkgwwU2xXiMw283jcno6zn1jcFs0tuTZhlSwvMjutOqGsP82ggQ FF1PW1O2GkoEkJU4o2LVQ5a3OcLG+2vAu9UfoMsCvkw4kosoIFTZmoYhNh90ZwSdX9OO SVuQ== X-Forwarded-Encrypted: i=1; AFNElJ+p738wOzo1q+jbR3pa2v9QOAeQvOpqITPzUIGAlC65oARuJgcwcczwxIudYPhRIK6VipIcOPYyiNbLdCc=@vger.kernel.org X-Gm-Message-State: AOJu0YxqUE82GgrViwYZWjj8wt0cbMutwMTQXOVCLd2IpLpTdph/5Oi4 D6DikXrYiXRtxiHb+aglJ51bHvEHiiHYCLDxjr4eMXtDVkRbf3e2BEjN+4lkoHUU9qS67IUzEg6 dqPsH9LFoUwGZgpZ/iQ== X-Received: from wmbjl6.prod.google.com ([2002:a05:600c:6a86:b0:48a:7f8c:a95a]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:190b:b0:490:9804:afdc with SMTP id 5b1f17b1804b1-490c25ff35dmr400245265e9.23.1781075295394; Wed, 10 Jun 2026 00:08:15 -0700 (PDT) Date: Wed, 10 Jun 2026 07:08:14 +0000 In-Reply-To: <20260608-queue-data-sync-v1-1-0efff051aaf3@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260608-queue-data-sync-v1-1-0efff051aaf3@kernel.org> Message-ID: Subject: Re: [PATCH] rust: block: require `Sync` for `Operations::QueueData` From: Alice Ryhl To: Andreas Hindborg Cc: Boqun Feng , Miguel Ojeda , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Trevor Gross , Danilo Krummrich , Jens Axboe , Daniel Almeida , linux-block@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Mon, Jun 08, 2026 at 10:24:34AM +0200, Andreas Hindborg wrote: > 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") > Signed-off-by: Andreas Hindborg Reviewed-by: Alice Ryhl