From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44CC8606A31A for ; Tue, 1 Dec 2026 17:17:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ehMkNMZy Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A96B810EA06; Tue, 1 Dec 2026 17:16:57 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9DFE210EA06 for ; Tue, 1 Dec 2026 17:16:51 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 72D6744385; Tue, 1 Dec 2026 17:16:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFFA71F00919; Tue, 1 Dec 2026 17:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796145411; bh=XKoAaVW3YaIO4aRBjFq/1VNeGxh+Pe/DA/G7FAWTZHY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ehMkNMZywUrBgil2lIIq+ChR+6YbwUdSrVsYj9YSoJ0pBGbcMEtIo3wbF1uSJqQG1 QsJ8bHID+SGD6maSMNY56Vx5N+E0OLQ8Gi7RIvQ3lXKdafyTJSjm31BZ/k8EI+seIY yzpu3hdLaBl+h5tK5b3fCmsBdMQQwxLnCjLtpRXSYaH2ITp/Hm9nqR4XeagQyU45St /ZoC+eZuD+ky8sWC1qi2/1MEb1bzs2AsaYWrrqqpQOLKcv0O6P/fom2JkzwLlpqqVu ih/CVbv0r+Bv7/xM0zw992OPcDphTMQst/Dd/CEZXcJsBc8dDRqhu3SyGCn/LhWghZ GhMBhxaUzuIEQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v3 09/13] iomap: don't ask for a buffered fallback for dma-buf iterators To: "Nitesh Shetty" Cc: dri-devel@lists.freedesktop.org, nvdimm@lists.linux.dev, linux-ext4@vger.kernel.org, tytso@mit.edu, media-ci@linuxtv.org In-Reply-To: <20261201155938.3028275-10-nj.shetty@samsung.com> References: <20261201155938.3028275-1-nj.shetty@samsung.com> <20261201155938.3028275-10-nj.shetty@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 17:16:50 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] iomap: blocking -EAGAIN on -EBUSY in __iomap_dio_rw() breaks XFS and IOPOLL -- commit e6c38297f83152550306506a0aa0d60de11399b1 Author: Mengmeng Zhao iomap: don't ask for a buffered fallback for dma-buf iterators This commit updates __iomap_dio_rw() so that dma-buf iterators do not return -ENOTBLK to request a buffered I/O fallback, instead mapping page invalidation -EBUSY failures to -EAGAIN and zero-progress -ENOTBLK callbacks to -EOPNOTSUPP. > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 1cd907204501f..be7f3ef57d8a4 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c [ ... ] > @@ -832,6 +834,13 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *= iter, > * the caller tries again. > */ > ret =3D -EAGAIN; > + } else if (iov_iter_is_dmabuf_map(iter)) { > + /* > + * a busy folio is transient, let the > + * caller retry the direct write > + */ > + if (ret =3D=3D -EBUSY) > + ret =3D -EAGAIN; > } else { > /* fall back to buffered write */ > ret =3D -ENOTBLK; [Severity: High] Can mapping -EBUSY to -EAGAIN when IOCB_NOWAIT is clear trigger an ASSERT failure and an infinite loop in xfs_file_dio_write_unaligned()? When IOCB_NOWAIT is not set, kiocb_invalidate_pages() blocks on writeback and returns -EBUSY from invalidate_inode_pages2_range() if a folio in the target range remains pinned or dirty. For a sector-aligned but block-unaligned blocking direct write in XFS, the exclusive retry pass clears IOMAP_DIO_OVERWRITE_ONLY and assumes -EAGAIN can only come from the initial overwrite-only attempt: fs/xfs/xfs_file.c:xfs_file_dio_write_unaligned() { ... retry_exclusive: iolock =3D XFS_IOLOCK_EXCL; flags =3D IOMAP_DIO_FORCE_WAIT; ... ret =3D iomap_dio_rw(iocb, from, &xfs_direct_write_iomap_ops, &xfs_dio_write_ops, flags, NULL, 0); /* * Retry unaligned I/O with exclusive blocking semantics if the *DIO layer rejected it for mapping or locking reasons. If we are * doing nonblocking user I/O, propagate the error. */ if (ret =3D=3D -EAGAIN && !(iocb->ki_flags & IOCB_NOWAIT)) { ASSERT(flags & IOMAP_DIO_OVERWRITE_ONLY); xfs_iunlock(ip, iolock); goto retry_exclusive; } ... } Returning -EAGAIN on the retry_exclusive pass trips this ASSERT and loops back to retry_exclusive indefinitely while the folio stays busy. On an io_uring ring configured with IORING_SETUP_IOPOLL, returning -EAGAIN to a blocking io-wq worker similarly causes io_write() and io_wq_submit_work() to spin retrying io_issue_sqe(). Leaving ret as -EBUSY returns the invalidation failure directly to the caller. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201155938.3028= 275-1-nj.shetty@samsung.com?part=3D9