From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794903967; b=3PYxAs+0ETxuHQIwXEGv3tLN/aUJfjJrAoDZllkkFCfAj+JSolsJmpUDDJEPr0a8Rx28 PV/WGzKcbiOdyVVGTGCbNsqEOAjgzuds/uoGyt3JwGa69ggWUbfIGfs/MSBb1ody3dEvb Edh5SMs5Pkpl2XL4cncc7FLlhl9dHLTn+88eJs7Q0E5D8Q0q6r6EdXsutnRBLHHgqfJos h+iGoiL2mDEIlcuJ5v0fribw+7NRg3uDxE1uOYA2wIZaYLovereZRfy7Un+qxfG+kS5jd 9f6Owz0HzVE4GDJnIpsO6bcjC5PbG2AoGeTCxEr+XBlnxRITXr1ODvpswpHFLTEmwWg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794903967; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:Content-Transfer-Encoding:User-Agent:MIME-Version; bh=z/NZRmC5bENRF/WsK1hUt6gARTy1xozW3x04wBCWbAk=; b=szq9/AZ4W/Do5T/6Pw5uETnvQkXODbv8Gks5eypxRnPJg8JUDDztmjhFiAP6J98zXWxx rP/TnlPASqSEKS5gSuWvdwygmYbLfbD/ZygOY7GJWiFHrAjDom3Wq3jxNlGC/2kWdl/Yt MzteP3SdQxsRZ9XLne1wkKlDN4xlVF7oc5FwIo7wtCCQHloTZ/34RDIBLyccb4ziGHr62 9O6Rea6G5X/R6+ga4ly8ODSNr/eFx6qZbUF6mhozghor5//G4ZTPBs4iebjTE7AILPfWb 1bm5bJYDfdhYrCcyChc3vJWqlvWF4z6xRf1X6ky3486Cncn999yTBO9f9nIi8gxi10A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=amutable.com; spf=pass smtp.mailfrom=amutable.com; dkim=pass header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=cds43TFp; arc=none smtp.remote-ip=209.85.128.50 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13CC5606A329 for ; Tue, 17 Nov 2026 08:26:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 13CC5606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amutable.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amutable.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=cds43TFp Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4bb55cda775so4353885e9.0 for ; Tue, 17 Nov 2026 00:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amutable-com.20260707.gappssmtp.com; s=20260707; t=1794903965; x=1795508765; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=z/NZRmC5bENRF/WsK1hUt6gARTy1xozW3x04wBCWbAk=; b=cds43TFp7I9j7WPcDQvYfHpQ9LovbzzVif9J1GAb84gdrUsjaaD/ks8/CxWEGRZF0/ 68hyeBKuGnu6JbonI+DUrAk+S9ERoS7tOFFA4H5eAQDr7L4jclXV2ELfZ8mKm2Ufg0Vf wmDFKHpSFXtb9q6HdOEKHOgWOeHJI7n45fohFUmuSejGQMSPwWlozLhppiRP7NP6/RTN Xh3C0JkZ12tnXvLGCknth+xcOYp3m/oSfXqUlVI9cwzFe0Rue3P0S85bM03sQyFUoXwh 8JJkMFcg0oB6zhSAQwaixAlqp7dYBZf2pow5RK/cSK97CWugz7jqMDtCMqYWg5eRSPcE y3pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794903965; x=1795508765; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=z/NZRmC5bENRF/WsK1hUt6gARTy1xozW3x04wBCWbAk=; b=R6nF06Hre7rmu8cHu3prLkOJbnfasxDZ8EieGC1lgauCVMdTjZO2roY/s45dMfucti ZGoHmKsUOW/CjOMuRL7DDwOpeQbMpdDWn7gYLc0wOt6Nl7OYDnp4efZ+ouLxBHFf3ika qk0Lxm+tSzNESN4osO20NkBAy7FgHHBPiJbzv1nXAdjxXsnxJHezXUF5jyZow2kmUsuE jb8FIpzwmIDDW7gccG9PvbhdYGLqXyArEQ2jyV6wp3WHGHZKK4r5BRv5jo49GtvAhUK/ XcaU1K+GwHnNvtd2bcySk5hu5uzA2dMG6RQVsQSFepZcBQ/MMGKD5IOC6jyp3eCY64wE lTPA== X-Forwarded-Encrypted: i=1; AL+hErHIlK+0W/MQ5Igtx6hndXRbhvcPvhbAzUGnIqelhLWoUVIXajj40jiS+/wVrK9zVwddkUerg5VZXec=@vger.kernel.org X-Gm-Message-State: APuU4Z8ekzrqoD6jx0AcTSX108PL5dFlzbAlvkW/xPg1BTP56ENTgg2N LLvi3cXRBg4dQWQ66tDjKvjdsWAJEPrV5oCETKhAVlB7KUJg1eZz8TfxZP0OwG6xb8z6 X-Gm-Gg: AYBFou0Hj9iOVviqfKPPD9dxeJrvrCQgYfu5ip9KWudJlqV6u+gGcYO7GXVuKs0uFzO ECEu6DIPiX+hUPqbiwdcmFhXeK4U9ox9Pn8gTWxh8v9iXXIyQKRlNFA691mT+xvVqg4lZQSe7Ov h6HxnEDn/dwkvawf76r56Ecn0Q60Euzu+fdjGXRNb8kLMjhj6FW2Tfk8F/5mc+r7qKPQevoSPj9 JTu8ESfiAAtdTs6PzqHOrO+GuFDukTFBSlj0l13TGo2LOwCyT+93t7gOLpDroxf3gHfGcTqll1N 4U8L/fCZIEl+pSl/R2t268qxXCBROT/94JyE2gsaO4MepJZYipB9LjVCs96uw6qisNoNecDvR3u hscQZtbkkk/wFBKVDQ2YspTyeSrriaVDAPBL6EmMFkpZ2mVu5KJeAuzNnlnp6mY1BA3LKS/19oA QxpbRh1KsSnKXXPmkoMMGk4OmPVflXISDyzNkJjpngh3Uk6/2cDuUzrw8dhFbWanBX1JuFgOjhG 8okP0FlCXjDK0LmfWBXzXxyI6J2nCd4LsSC7n1S9zry4n8Uxj2uiCbES0mp7FwNI9FQRgSkGsz1 PP6dMnkUNnzsfDFfMrvjSZgaUnos/lBCE80cfQ4ipDw54/PCI0xS81jln9dZQspwx3FkJoLrL0l qivAvUtvAcEDdtm/kgo16fwUuJyB7lTjs8hHbnGDLPhhUF2bzXq7agol/ X-Received: by 2002:a05:600c:5493:b0:4a1:c27d:e1a8 with SMTP id 5b1f17b1804b1-4bb783813a7mr42606245e9.10.1794903965400; Tue, 17 Nov 2026 00:26:05 -0800 (PST) Received: from ?IPv6:2003:cf:572c:2800:de4c:6789:33ce:97c2? (p200300cf572c2800de4c678933ce97c2.dip0.t-ipconnect.de. [2003:cf:572c:2800:de4c:6789:33ce:97c2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb7ad9430asm12629125e9.15.2026.11.17.00.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 00:26:05 -0800 (PST) Message-ID: <88041240268f70b218de7dfd58c41977d03a60d3.camel@amutable.com> Subject: Re: [PATCH RFC v3 03/44] target: fileio: check that the backing file supports ->{read,write}_iter From: Alexander Mikhalitsyn To: Christian Brauner , linux-fsdevel@vger.kernel.org Cc: Jann Horn , Chris Mason , Josef Bacik , Christoph Hellwig , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, Alexander Viro , Jan Kara , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, driver-core@lists.linux.dev, linux-mm@kvack.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, apparmor@lists.ubuntu.com, linux-nfs@vger.kernel.org, netdev@vger.kernel.org, fuse-devel@lists.linux.dev, linux-efi@vger.kernel.org, xen-devel@lists.xenproject.org, ocfs2-devel@lists.linux.dev, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-usb@vger.kernel.org, Amir Goldstein , linux-erofs@lists.ozlabs.org, linux-kselftest@vger.kernel.org, Chris Down Date: Tue, 17 Nov 2026 09:26:03 +0100 In-Reply-To: <20261116-work-loop-pseudo-v3-3-8cbbea1cf34f@kernel.org> References: <20261116-work-loop-pseudo-v3-0-8cbbea1cf34f@kernel.org> <20261116-work-loop-pseudo-v3-3-8cbbea1cf34f@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-0+deb13u1 X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Mon, 2026-11-16 at 12:04 +0100, Christian Brauner wrote: > With fd_async_io=3D1 the fileio backend calls ->read_iter() and > ->write_iter() of the backing file directly. The synchronous path > goes > through vfs_iter_read() and vfs_iter_write() which check for them but > the aio path doesn't. So a backing file without them calls a NULL > pointer on its first I/O. >=20 > Refuse such files when configuring the device. On the synchronous > path > every read or write that needed the missing method failed with EINVAL > anyway. >=20 > Fixes: 769031c92c8b ("scsi: target: target/file: Add support of > direct and async I/O") > Reviewed-by: Jan Kara > Reviewed-by: Christoph Hellwig > Reviewed-by: Chris Down Reviewed-by: Alexander Mikhalitsyn > Signed-off-by: Christian Brauner (Amutable) > --- > =C2=A0drivers/target/target_core_file.c | 8 ++++++++ > =C2=A01 file changed, 8 insertions(+) >=20 > diff --git a/drivers/target/target_core_file.c > b/drivers/target/target_core_file.c > index ab9824a4852f1..a5391e57e9aa5 100644 > --- a/drivers/target/target_core_file.c > +++ b/drivers/target/target_core_file.c > @@ -144,6 +144,14 @@ static int fd_configure_device(struct se_device > *dev) > =C2=A0 goto fail; > =C2=A0 } > =C2=A0 fd_dev->fd_file =3D file; > + > + if (!file->f_op->read_iter || !file->f_op->write_iter) { > + pr_err("FILEIO: %s lacks ->read_iter or - > >write_iter\n", > + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fd_dev->fd_dev_name); > + ret =3D -EINVAL; > + goto fail; > + } > + > =C2=A0 /* > =C2=A0 * If using a block backend with this struct file, we > extract > =C2=A0 * fd_dev->fd_[block,dev]_size from struct block_device.