From patchwork Fri May 26 02:25:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13256315 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5566C77B7E for ; Fri, 26 May 2023 02:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232645AbjEZCZc (ORCPT ); Thu, 25 May 2023 22:25:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230289AbjEZCZb (ORCPT ); Thu, 25 May 2023 22:25:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9849EB2 for ; Thu, 25 May 2023 19:25:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 361DA64C4C for ; Fri, 26 May 2023 02:25:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A287C433D2; Fri, 26 May 2023 02:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685067929; bh=bZtEIHYsGtTj1COEIFN2PanEklGygPPwmg3dvRp9GYQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=boWL5x11FZGNICQ+IqYWlTlIljmSSMDDn2B/lUEIYlWxpCUzCIul1v4lUnPC4nWGz S9SvdIL0MyG5laCGNl59AGpRZa/SAdNF49CY730yZ77ayyxKqaFkuFTsSAAASbad03 m6nr/ZUxvjO3WTAM3rpmvV15se6R1JF4aYfoVPNt+hNsTKoQCmYddeLiDMT2baq4Cg rgwoofQmtgD4TcTM++fVXp8amMwhmx1OucpWfqqk2jvFuGDEQz5c7/g0uiPTLOysIo WL4LFbNqJ4dXVV+cQzZJpsLHcAjs0MM84+SAmMfV5H63wVtoOHf3tUgWIqyBj3Nn8Q cjJbKe7Ko6n8Q== Date: Thu, 25 May 2023 19:25:29 -0700 Subject: [PATCH 14/30] xfs: don't remove the attr fork when parent pointers are enabled From: "Darrick J. Wong" To: djwong@kernel.org, cem@kernel.org Cc: Allison Henderson , linux-xfs@vger.kernel.org, allison.henderson@oracle.com, catherine.hoang@oracle.com Message-ID: <168506078078.3749421.2850981743882573422.stgit@frogsfrogsfrogs> In-Reply-To: <168506077876.3749421.7883085669588003826.stgit@frogsfrogsfrogs> References: <168506077876.3749421.7883085669588003826.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Allison Henderson When an inode is removed, it may also cause the attribute fork to be removed if it is the last attribute. This transaction gets flushed to the log, but if the system goes down before we could inactivate the symlink, the log recovery tries to inactivate this inode (since it is on the unlinked list) but the verifier trips over the remote value and leaks it. Hence we ended up with a file in this odd state on a "clean" mount. The "obvious" fix is to prohibit erasure of the attr fork to avoid tripping over the verifiers when pptrs are enabled. Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- libxfs/xfs_attr_leaf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index d737d4163dd..a7845da9bcc 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -910,7 +910,8 @@ xfs_attr_sf_removename( totsize -= size; if (totsize == sizeof(xfs_attr_sf_hdr_t) && xfs_has_attr2(mp) && (dp->i_df.if_format != XFS_DINODE_FMT_BTREE) && - !(args->op_flags & (XFS_DA_OP_ADDNAME | XFS_DA_OP_REPLACE))) { + !(args->op_flags & (XFS_DA_OP_ADDNAME | XFS_DA_OP_REPLACE)) && + !xfs_has_parent(mp)) { xfs_attr_fork_remove(dp, args->trans); } else { xfs_idata_realloc(dp, -size, XFS_ATTR_FORK); @@ -919,7 +920,8 @@ xfs_attr_sf_removename( ASSERT(totsize > sizeof(xfs_attr_sf_hdr_t) || (args->op_flags & XFS_DA_OP_ADDNAME) || !xfs_has_attr2(mp) || - dp->i_df.if_format == XFS_DINODE_FMT_BTREE); + dp->i_df.if_format == XFS_DINODE_FMT_BTREE || + xfs_has_parent(mp)); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); }