From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 C66213DC4CC; Mon, 5 Oct 2026 21:12:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791234757; cv=none; b=LWaJZmmQ/3DiGhzbJ3FC/Thmxp/xHVi73LzD5YaGJQC9fUNc+27F5NEY1w767SKi3ZokRxngsN/AeHiKTiOO5c+1XDqDbNJ/19DoXS/OrHzWfZuY+oKdRi73UcRYJyjNESntgvmtEuH2baY6EpqoActvzFQNA7Q9izl188invFo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791234757; c=relaxed/simple; bh=6jF9c9FGtkd+lWxT4xDLQUJQcMFzWy2WRuHYKakSFQk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k3Nas6d23m1HX11GwKR6MiWx5svUjW2+pfbGHRd0KQYfFsudlkgobiwSHU3TbVxKup6jMU6b22lopDfpNmUCKFRZkSxygrxLk1tzSwc3YzuXjQ0mkSiuxUsXdLUmB0WRl8CLGVC4/QZpsHTyv0suybsBU7gobMTpYgHLyk8b7NQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HJteQIa/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HJteQIa/" Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 597531F000FF; Mon, 5 Oct 2026 21:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1791234756; bh=tWny7OQoIybWrVpLqJVtZbV0h7M1yQfOw+IiB5CpJ1Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=HJteQIa/DDzgnwyJHNbSCu+IWvB1GpDJUesTphW48b60A2/0GRigCUS7194OP5m3s LznhOFBx8V60WNnU6TgcbnfjkZ+PEFWD3XjqDSwUM5j7+SX4hnw8kf0UtartFyXHLg PHYvoGd2j/k6UJfyQPokSWmM3/0jJcRqbWZ5k3anZTwHQgvJlayp9hSdRQDZwrax+7 giYaXZ09baiLJ/5pvHPX56cgLGnHOtmkdaRyWOBcSx0pTqS2/Ht5qeVe4TuHThbYhd 4hvzwzFJj4Zo/rgJfAr7p05yzBWMZbvXnR1l42A19uhK9ogaMXTxZAlO8gbE4RygkZ djvHaykCksmLg== Date: Mon, 5 Oct 2026 14:12:35 -0700 From: "Darrick J. Wong" To: Andrey Albershteyn Cc: ebiggers@kernel.org, hch@lst.de, Carlos Maiolino , fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org, david@fromorbit.com Subject: Re: [PATCH v17 15/21] xfs: add fs-verity support Message-ID: <20261005211235.GF2705364@frogsfrogsfrogs> References: <20261002223705.2175542-1-aalbersh@kernel.org> <20261002223705.2175542-16-aalbersh@kernel.org> Precedence: bulk X-Mailing-List: fsverity@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Oct 05, 2026 at 07:18:35PM +0200, Andrey Albershteyn wrote: > > +/* > > + * Try to remove all the fsverity metadata after a failed enablement. > > + */ > > +static int > > +xfs_fsverity_delete_metadata( > > + struct xfs_inode *ip) > > +{ > > + struct xfs_trans *tp; > > + struct xfs_mount *mp = ip->i_mount; > > + int error; > > + > > + xfs_ilock(ip, XFS_MMAPLOCK_EXCL); > > + error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); > > + if (error) { > > + xfs_iunlock(ip, XFS_MMAPLOCK_EXCL); > > + return error; > > + } > > + > > + truncate_inode_pages(VFS_I(ip)->i_mapping, XFS_ISIZE(ip)); > > Oh I haven't paid enough attention here, it has to be moved before > xfs_ilock(ip, XFS_MMAPLOCK_EXCL) not just before the lock, to exclude > ABBA with writeback/reclaim taking folio lock and waiting for trans > space. Hrm? You have to hold IOLOCK and MMAPLOCK, and *not* hold ILOCK, to truncate the pagecache. IOWs, xfs_ilock(ip, XFS_MMAPLOCK_EXCL); truncate_inode_pages(VFS_I(ip)->i_mapping, XFS_ISIZE(ip)); error = xfs_trans_alloc(...); if (error) ... xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); --D > I will send v18 if more feedback will arrive, otherwise, I can > resend just this patch (or could be fixed during merge?). > > -- > - Andrey > 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 D093FCA5FF0 for ; Mon, 5 Oct 2026 21:12:45 +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:In-Reply-To:MIME-Version:References: Message-ID:To:Date:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=p1SnEpPDseTNe4nCdol9QMudUMDkt+wQVXqKbdsdnhQ=; b=YC7PF5NWXdekyf3I/csXB9RJyy fdsEmLu4LjPHHqcdxCly37v2xatVAk5tqAOWDct7ml7ltLxmpMWBujf8ldAGZaJKTnKav/TV9F25C MKEb4lWc6KUZDfS7e0YCbpFuy9PpgpTBwKh+2bcun+iRVERZ7UMMKnb5bfKKfIKI47+I=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1xDpzI-00026O-6h; Mon, 05 Oct 2026 21:12:44 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1xDpzG-00026I-Ux for linux-f2fs-devel@lists.sourceforge.net; Mon, 05 Oct 2026 21:12:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: 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=tWny7OQoIybWrVpLqJVtZbV0h7M1yQfOw+IiB5CpJ1Y=; b=aTOkj7B9HqJz9GqVXh5TeXyPvd njpwH6Rq2YwWuDyJ9gKSCWZP31iq8IWB8/tAlFop9pVjYeJSs34u4507Ltp1a7f8kE+JIikixJThZ rL4UQUxdECH0W7HLnOODZq3m8i3pKgm8rd9p+Fc6YGMvoGXAUyTzh0JvKtRWo32Rnq/o=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding: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=tWny7OQoIybWrVpLqJVtZbV0h7M1yQfOw+IiB5CpJ1Y=; b=chURPc1NfDfinM4o4xs4e38WJZ 6NmzFlO9v35k17YNX44z5jgG82hpANYNLk5IwTQH8A02oKv0nsKrRBPkJ3HllJZ8PQgCAk8HYHtcE wcfmi6zbOmjcCdoLTQFm+z+NRedom2K39/mFT62gDc4TZ3Ct9OWMeySrcUIEJ1PN+vUk=; 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 1xDpzG-000283-AE for linux-f2fs-devel@lists.sourceforge.net; Mon, 05 Oct 2026 21:12:43 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with UTF8SMTP id B2FAD60008; Mon, 5 Oct 2026 21:12:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 597531F000FF; Mon, 5 Oct 2026 21:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1791234756; bh=tWny7OQoIybWrVpLqJVtZbV0h7M1yQfOw+IiB5CpJ1Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=HJteQIa/DDzgnwyJHNbSCu+IWvB1GpDJUesTphW48b60A2/0GRigCUS7194OP5m3s LznhOFBx8V60WNnU6TgcbnfjkZ+PEFWD3XjqDSwUM5j7+SX4hnw8kf0UtartFyXHLg PHYvoGd2j/k6UJfyQPokSWmM3/0jJcRqbWZ5k3anZTwHQgvJlayp9hSdRQDZwrax+7 giYaXZ09baiLJ/5pvHPX56cgLGnHOtmkdaRyWOBcSx0pTqS2/Ht5qeVe4TuHThbYhd 4hvzwzFJj4Zo/rgJfAr7p05yzBWMZbvXnR1l42A19uhK9ogaMXTxZAlO8gbE4RygkZ djvHaykCksmLg== Date: Mon, 5 Oct 2026 14:12:35 -0700 To: Andrey Albershteyn Message-ID: <20261005211235.GF2705364@frogsfrogsfrogs> References: <20261002223705.2175542-1-aalbersh@kernel.org> <20261002223705.2175542-16-aalbersh@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1xDpzG-000283-AE Subject: Re: [f2fs-dev] [PATCH v17 15/21] xfs: add fs-verity support 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: "Darrick J. Wong via Linux-f2fs-devel" Reply-To: "Darrick J. Wong" Cc: fsverity@lists.linux.dev, linux-xfs@vger.kernel.org, Carlos Maiolino , david@fromorbit.com, linux-unionfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, ebiggers@kernel.org, linux-fsdevel@vger.kernel.org, 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 On Mon, Oct 05, 2026 at 07:18:35PM +0200, Andrey Albershteyn wrote: > > +/* > > + * Try to remove all the fsverity metadata after a failed enablement. > > + */ > > +static int > > +xfs_fsverity_delete_metadata( > > + struct xfs_inode *ip) > > +{ > > + struct xfs_trans *tp; > > + struct xfs_mount *mp = ip->i_mount; > > + int error; > > + > > + xfs_ilock(ip, XFS_MMAPLOCK_EXCL); > > + error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); > > + if (error) { > > + xfs_iunlock(ip, XFS_MMAPLOCK_EXCL); > > + return error; > > + } > > + > > + truncate_inode_pages(VFS_I(ip)->i_mapping, XFS_ISIZE(ip)); > > Oh I haven't paid enough attention here, it has to be moved before > xfs_ilock(ip, XFS_MMAPLOCK_EXCL) not just before the lock, to exclude > ABBA with writeback/reclaim taking folio lock and waiting for trans > space. Hrm? You have to hold IOLOCK and MMAPLOCK, and *not* hold ILOCK, to truncate the pagecache. IOWs, xfs_ilock(ip, XFS_MMAPLOCK_EXCL); truncate_inode_pages(VFS_I(ip)->i_mapping, XFS_ISIZE(ip)); error = xfs_trans_alloc(...); if (error) ... xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); --D > I will send v18 if more feedback will arrive, otherwise, I can > resend just this patch (or could be fixed during merge?). > > -- > - Andrey > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel