From patchwork Fri May 26 02:14:18 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: 13256267 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 5A5B0C77B7A for ; Fri, 26 May 2023 02:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229530AbjEZCOZ (ORCPT ); Thu, 25 May 2023 22:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjEZCOV (ORCPT ); Thu, 25 May 2023 22:14:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63B4813D for ; Thu, 25 May 2023 19:14:20 -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 0070664768 for ; Fri, 26 May 2023 02:14:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64561C433D2; Fri, 26 May 2023 02:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685067259; bh=gU7IdZHRX6DzOosWLxXHOCmVzlR23yww/Zdxiabbrrk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=D9NsJtxnlkDiTlQ+9rL8/ExxMlUuc2MXaTggrtHvriv/LtG0cvYB5plSOVlLPxXkP P6e++6CZhz7MkNJMtUgGzfF6gOlr4CAT3XqgMWFW2orFYAYE/EHEREULDFS2Xf4z47 +wLpo/eh1vePVDdqxMHQF5FrI0kBwaCsT6INLUNNobOyI+lNTOMY+geoZrtAy/1Hwe 0rJ+NWsfZSAOetVbT2v1KYfd+jjdTderl8zYNW9ajbBOYsYFcfJHyr5g8ZEuqm9aLW sVYsqfavVbFYc21E03GQXaN+UOh6xA3ZuTBq0C4rIs9LqZNEcihlYf9+5fsM5T1bai kJrU3ZLxuT29g== Date: Thu, 25 May 2023 19:14:18 -0700 Subject: [PATCH 17/18] xfs: don't remove the attr fork when parent pointers are enabled From: "Darrick J. Wong" To: djwong@kernel.org Cc: Allison Henderson , linux-xfs@vger.kernel.org, allison.henderson@oracle.com, catherine.hoang@oracle.com Message-ID: <168506072944.3744191.9181014638334683414.stgit@frogsfrogsfrogs> In-Reply-To: <168506072673.3744191.16402822066993932505.stgit@frogsfrogsfrogs> References: <168506072673.3744191.16402822066993932505.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 --- fs/xfs/libxfs/xfs_attr_leaf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 884528ca3b49..54b38e6528f2 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -913,7 +913,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); @@ -922,7 +923,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); }