From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E97F739EF06; Mon, 20 Apr 2026 11:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776685694; cv=none; b=F2HCyVRXlAqTpnKXeDeag63w1mCx96ghgl78skLzpGvrEiZU4jVZu8N52bekbguNePMDo5iFDW1zCJ0l5mbGVvPETDbdO7RHxOJV0UAgGkmfoVO3fN3yv3XmH2cNx7C6ZIpL3OrqVMchpQP3YrpnXkbbupiMi1RkU/jCEG/wW0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776685694; c=relaxed/simple; bh=l2TuE4Dq3W00QnGqh26ac7WtX/eqBCa3lcQ4ZM8TF1E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R5qGD0sIM1+Duv1bgcqghQ75qZamRJb2wOA60zGQwkD9Sql0dJp5O6Bswpi3qBNX/xgdW/SECqadGGvdUX2wuC6FJlIWZuZPWg7VN3H4gRqGntZ7goE6xVlSHsAal8mKJMU4+VuSEklyy2DicmzGMBf6+JbK2epqW9r8tfUNyUg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YbsiTSsX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YbsiTSsX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC13C19425; Mon, 20 Apr 2026 11:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776685693; bh=l2TuE4Dq3W00QnGqh26ac7WtX/eqBCa3lcQ4ZM8TF1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YbsiTSsXmj626FnFRrw/igFrrEYPaX8L5UWJkEq/dlac3+x7BrEwPYORLk6mrcR49 9Ig8/DDh87c0hZ9mqeqxdHd23pYazUkbxfE5RiPVP2XpBBycAccCH1mX3zqi5LaND/ embWPtsbiuBNLI3EYaLrsK0g2bozSeS2p0LQzn509RzJNmTDY7uiqvA0Y21GiXSslt uQJHg9buU6MT9m/k2/+b4elUUK+uNmGagHJGTYZiED0nhwxYMuz1X6U9a5dbKkDEwW EV6AK4/xkP0BZhEQn6Dr56vz3QnsrSQ1gzXe2fWDHvR0jSOgXsFlZU58LWPeGYvtkr eB9W0uT0J+yOg== From: Andrey Albershteyn To: linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org Cc: Andrey Albershteyn , hch@lst.de, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org, linux-unionfs@vger.kernel.org, djwong@kernel.org Subject: [PATCH v8 13/22] xfs: disable direct read path for fs-verity files Date: Mon, 20 Apr 2026 13:47:00 +0200 Message-ID: <20260420114714.1621982-14-aalbersh@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260420114714.1621982-1-aalbersh@kernel.org> References: <20260420114714.1621982-1-aalbersh@kernel.org> Precedence: bulk X-Mailing-List: fsverity@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The direct path is not supported on verity files. Attempts to use direct I/O path on such files should fall back to buffered I/O path. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Andrey Albershteyn --- fs/xfs/xfs_file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index a980ac5196a8..6fa9835f9531 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -282,7 +282,8 @@ xfs_file_dax_read( struct kiocb *iocb, struct iov_iter *to) { - struct xfs_inode *ip = XFS_I(iocb->ki_filp->f_mapping->host); + struct inode *inode = iocb->ki_filp->f_mapping->host; + struct xfs_inode *ip = XFS_I(inode); ssize_t ret = 0; trace_xfs_file_dax_read(iocb, to); @@ -333,6 +334,14 @@ xfs_file_read_iter( if (xfs_is_shutdown(mp)) return -EIO; + /* + * In case fs-verity is enabled, we also fallback to the buffered read + * from the direct read path. Therefore, IOCB_DIRECT is set and need to + * be cleared (see generic_file_read_iter()) + */ + if (fsverity_active(inode)) + iocb->ki_flags &= ~IOCB_DIRECT; + if (IS_DAX(inode)) ret = xfs_file_dax_read(iocb, to); else if (iocb->ki_flags & IOCB_DIRECT) -- 2.51.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCC7FF5581E for ; Mon, 20 Apr 2026 11:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:MIME-Version:References:In-Reply-To: Message-ID:Date:To:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3sP00QLGa1BkX94twFSN8lkgfctZQi8UMhZZitaYmw0=; b=jRCgog1jX0lDiTy/qQlSOCCfxF 6SmX4bpuUDT11jf2YgfM3B6uaHRUAS6vPz5acnkiG+EIjPlAi4n1SYbSdSssJ6V67R9LP+I61XLyF zxFieQwqhKS3x5DG5pDrqASquWWlhkpQcJ35S7ZnSG/ukl8tWxrzZsAKLkC4RRTkyBXk=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wEn71-0007wc-OZ; Mon, 20 Apr 2026 11:48:21 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wEn70-0007wT-LC for linux-f2fs-devel@lists.sourceforge.net; Mon, 20 Apr 2026 11:48:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=L7lbVMXOwHHcAevnI59LdKxFWewGKSw08vt9Mtg3z1Q=; b=DcKiJR5uSOk1LYJ8q64Yl+2/Mu Jz2Ob/hdXFvtAStwejitR861Pe6GDQYE7sDClkLXqvOaLfhZ8tvpt0UNdHeGjFQIdiANeindYEUUM 5lWuv+oe7QO068mV8IIN2XIBpMC4cleNhp9Qrpj8keQWBXhyJ4yIt8Vhm14ib1Gh6mew=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=L7lbVMXOwHHcAevnI59LdKxFWewGKSw08vt9Mtg3z1Q=; b=aUd668xQT/g1MXLcXl+dzw+N4h jhAdduJjgeDkkQnJke2Zcb/9GwTh22+A5lBZs/DVhWzkgHwNfU4CR/HTwdhGlV3wFgM+WBT44QaBK nXrc7IUj5bN9aObAKFXC+82HUIa3D3LGRGIGM5N3SZcdtA31Pf56vSKL0bZEqz1aTPcM=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wEn6x-0007Fq-NP for linux-f2fs-devel@lists.sourceforge.net; Mon, 20 Apr 2026 11:48:20 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 271D260172; Mon, 20 Apr 2026 11:48:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC13C19425; Mon, 20 Apr 2026 11:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776685693; bh=l2TuE4Dq3W00QnGqh26ac7WtX/eqBCa3lcQ4ZM8TF1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YbsiTSsXmj626FnFRrw/igFrrEYPaX8L5UWJkEq/dlac3+x7BrEwPYORLk6mrcR49 9Ig8/DDh87c0hZ9mqeqxdHd23pYazUkbxfE5RiPVP2XpBBycAccCH1mX3zqi5LaND/ embWPtsbiuBNLI3EYaLrsK0g2bozSeS2p0LQzn509RzJNmTDY7uiqvA0Y21GiXSslt uQJHg9buU6MT9m/k2/+b4elUUK+uNmGagHJGTYZiED0nhwxYMuz1X6U9a5dbKkDEwW EV6AK4/xkP0BZhEQn6Dr56vz3QnsrSQ1gzXe2fWDHvR0jSOgXsFlZU58LWPeGYvtkr eB9W0uT0J+yOg== To: linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org Date: Mon, 20 Apr 2026 13:47:00 +0200 Message-ID: <20260420114714.1621982-14-aalbersh@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260420114714.1621982-1-aalbersh@kernel.org> References: <20260420114714.1621982-1-aalbersh@kernel.org> MIME-Version: 1.0 X-Headers-End: 1wEn6x-0007Fq-NP Subject: [f2fs-dev] [PATCH v8 13/22] xfs: disable direct read path for fs-verity files X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrey Albershteyn via Linux-f2fs-devel Reply-To: Andrey Albershteyn Cc: Andrey Albershteyn , djwong@kernel.org, linux-unionfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, hch@lst.de, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net The direct path is not supported on verity files. Attempts to use direct I/O path on such files should fall back to buffered I/O path. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Andrey Albershteyn --- fs/xfs/xfs_file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index a980ac5196a8..6fa9835f9531 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -282,7 +282,8 @@ xfs_file_dax_read( struct kiocb *iocb, struct iov_iter *to) { - struct xfs_inode *ip = XFS_I(iocb->ki_filp->f_mapping->host); + struct inode *inode = iocb->ki_filp->f_mapping->host; + struct xfs_inode *ip = XFS_I(inode); ssize_t ret = 0; trace_xfs_file_dax_read(iocb, to); @@ -333,6 +334,14 @@ xfs_file_read_iter( if (xfs_is_shutdown(mp)) return -EIO; + /* + * In case fs-verity is enabled, we also fallback to the buffered read + * from the direct read path. Therefore, IOCB_DIRECT is set and need to + * be cleared (see generic_file_read_iter()) + */ + if (fsverity_active(inode)) + iocb->ki_flags &= ~IOCB_DIRECT; + if (IS_DAX(inode)) ret = xfs_file_dax_read(iocb, to); else if (iocb->ki_flags & IOCB_DIRECT) -- 2.51.2 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel