From patchwork Tue Sep 12 17:39:04 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: 13381979 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 C52D0EE3F09 for ; Tue, 12 Sep 2023 17:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232791AbjILRjK (ORCPT ); Tue, 12 Sep 2023 13:39:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbjILRjJ (ORCPT ); Tue, 12 Sep 2023 13:39:09 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 542B1B7 for ; Tue, 12 Sep 2023 10:39:05 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5D83C433C7; Tue, 12 Sep 2023 17:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694540345; bh=DUNFrJVRPzuuY3hSpg61VBwvN6w9LeyzVteAnkjpJRI=; h=Date:Subject:From:To:Cc:From; b=Zx+tus4QnGPyA19xtJoW7XyVLlZRIbBwz+zsVdquDSPmk04VgKr2fyq6zpI2dIsI7 v6jJDpkRx8sHCl2wa1WmXaTCtKQewJcH1q9e2ccJHBqZZPcay1UIgetVm8Pd72tQbz m0NuJlIC/dJAKqmtYF5hgG+k51WFlPxhlJJvx/gEu2Q+wtXqKGVsvwdleM+3J5ib3G ROKX7wPxmfvJV3gXEpZtpcgt/EBu9sO3fZ4KfejZnuyZEkztklm2nVuAwFb3vOqlvA INNbMx7WR7/cfAYsPhn3RjnovJOFznMtsE3WyrpUbuh9DG+7uc5tTi/XmpMa468kxl kKBYJw+7wJh9A== Date: Tue, 12 Sep 2023 10:39:04 -0700 Subject: [GIT PULL 1/8] xfs: fix fsmap cursor handling From: "Darrick J. Wong" To: chandan.babu@gmail.com, djwong@kernel.org Cc: david@fromorbit.com, dchinner@redhat.com, linux-xfs@vger.kernel.org Message-ID: <169454023162.3411463.108211223548743239.stg-ugh@frogsfrogsfrogs> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Hi Chandan, Please pull this branch with changes. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit 0bb80ecc33a8fb5a682236443c1e740d5c917d1d: Linux 6.6-rc1 (2023-09-10 16:28:41 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-fsmap-6.6_2023-09-12 for you to fetch changes up to cfa2df68b7ceb49ac9eb2d295ab0c5974dbf17e7: xfs: fix an agbno overflow in __xfs_getfsmap_datadev (2023-09-11 08:39:02 -0700) ---------------------------------------------------------------- xfs: fix fsmap cursor handling [v2] This patchset addresses an integer overflow bug that Dave Chinner found in how fsmap handles figuring out where in the record set we left off when userspace calls back after the first call filled up all the designated record space. v2: add RVB tags This has been lightly tested with fstests. Enjoy! Signed-off-by: Darrick J. Wong ---------------------------------------------------------------- Darrick J. Wong (1): xfs: fix an agbno overflow in __xfs_getfsmap_datadev fs/xfs/xfs_fsmap.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) From patchwork Tue Sep 12 17:39:20 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: 13381980 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 16B95EE3F06 for ; Tue, 12 Sep 2023 17:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231201AbjILRjZ (ORCPT ); Tue, 12 Sep 2023 13:39:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233902AbjILRjY (ORCPT ); Tue, 12 Sep 2023 13:39:24 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB4DBB for ; Tue, 12 Sep 2023 10:39:21 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C789C433C7; Tue, 12 Sep 2023 17:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694540360; bh=HLzt2iQiWfvqrlJgMRABZdIX30rZnfL6kgorAmCBdf0=; h=Date:Subject:From:To:Cc:From; b=IZM/VE/6asicuqdJqP4PgixFjsB/y86iJaP74/msnJEwl+B6CqH9rdh+Rxkc73dX4 uyB0o4tJ4JwwLjJozWj2jgAgpticWbVCUbKOI/Xy/nPusHar275QXrGyn7O6CUGrrm Wb8y3XW7Pvihk4NJiRrj12gD4Kkg/k99asNjHF56ZhVO7fBN6eSnwTTrr+rwoDLgKD 4y7FtZbTKR2+K/4C5884TdOaYGy8Iz4AbiPGuiFtmrlk1+jsDdtItKe0lCMyIx2nAi wi3P5m4nC9NRymeGwiHWYKCG6zY9fzMbMn5H0ReT9xZT0OR5QpARRNBSQcahclJUgY AR3iZwkluwHzg== Date: Tue, 12 Sep 2023 10:39:20 -0700 Subject: [GIT PULL 2/8] xfs: fix cpu hotplug mess From: "Darrick J. Wong" To: chandan.babu@gmail.com, djwong@kernel.org Cc: david@fromorbit.com, dchinner@redhat.com, linux-xfs@vger.kernel.org, peterz@infradead.org, ritesh.list@gmail.com, sandeen@sandeen.net, tglx@linutronix.de Message-ID: <169454023254.3411463.11051130775444770690.stg-ugh@frogsfrogsfrogs> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Hi Chandan, Please pull this branch with changes. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit cfa2df68b7ceb49ac9eb2d295ab0c5974dbf17e7: xfs: fix an agbno overflow in __xfs_getfsmap_datadev (2023-09-11 08:39:02 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-percpu-lists-6.6_2023-09-12 for you to fetch changes up to ef7d9593390a050c50eba5fc02d2cb65a1104434: xfs: remove CPU hotplug infrastructure (2023-09-11 08:39:04 -0700) ---------------------------------------------------------------- xfs: fix cpu hotplug mess [v2] Ritesh and Eric separately reported crashes in XFS's hook function for CPU hot remove if the remove event races with a filesystem being mounted. I also noticed via generic/650 that once in a while the log will shut down over an apparent overrun of a transaction reservation; this turned out to be due to CIL percpu list aggregation failing to pick up the percpu list items from a dying CPU. Either way, the solution here is to eliminate the need for a CPU dying hook by using a private cpumask to track which CPUs have added to their percpu lists directly, and iterating with that mask. This fixes the log problems and (I think) solves a theoretical UAF bug in the inodegc code too. v2: fix a few put_cpu uses, add necessary memory barriers, and use atomic cpumask operations This has been lightly tested with fstests. Enjoy! Signed-off-by: Darrick J. Wong ---------------------------------------------------------------- Darrick J. Wong (4): xfs: fix per-cpu CIL structure aggregation racing with dying cpus xfs: use per-mount cpumask to track nonempty percpu inodegc lists xfs: remove the all-mounts list xfs: remove CPU hotplug infrastructure fs/xfs/xfs_icache.c | 78 +++++++++++++++-------------------------- fs/xfs/xfs_icache.h | 1 - fs/xfs/xfs_log_cil.c | 52 +++++++++------------------- fs/xfs/xfs_log_priv.h | 14 ++++---- fs/xfs/xfs_mount.h | 7 ++-- fs/xfs/xfs_super.c | 86 ++-------------------------------------------- include/linux/cpuhotplug.h | 1 - 7 files changed, 56 insertions(+), 183 deletions(-) From patchwork Tue Sep 12 17:39:35 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: 13381981 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 1B556EE3F08 for ; Tue, 12 Sep 2023 17:39:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233902AbjILRjl (ORCPT ); Tue, 12 Sep 2023 13:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235260AbjILRjk (ORCPT ); Tue, 12 Sep 2023 13:39:40 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AED71196 for ; Tue, 12 Sep 2023 10:39:36 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DC47C433C8; Tue, 12 Sep 2023 17:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694540376; bh=Q7bNXPA4Uv5g3GpKZYcBGKhjdoUXd8QM0dm2NyrXeeM=; h=Date:Subject:From:To:Cc:From; b=Qu36Vk+C81LveywuRAEIfs2n6Og7j2SsgyoTqlbB8apxJNG1LR2bPgzr1G5vTdfZB K7gLnkHg9lv/xsAPtrxsDuLCZdv77UuBkM4ZdGuAUS0pMVqjk2ZxZ2ynZ0nJMeSACY WUFpj2pPVQtKLi9TNbHgwHUncAWNnPE5vrE2rLFPWu1CqygBuEmndWhoiHCKJzySmT fHqtpL9V/zZTo2qrYXPvd+lofIZNnK6DVzZTyo359D4Z8LWxQja7ERwgDeEHgtEdSB LTj2EycwRhSyZlke33FM0cDQXc6xPPTJfz5R8v6rfqSq0pAswzJonB+objKbBABJ4p HtRnTdjiLhbwg== Date: Tue, 12 Sep 2023 10:39:35 -0700 Subject: [GIT PULL 3/8] xfs: fix ro mounting with unknown rocompat features From: "Darrick J. Wong" To: chandan.babu@gmail.com, djwong@kernel.org Cc: david@fromorbit.com, dchinner@redhat.com, linux-xfs@vger.kernel.org, sandeen@sandeen.net Message-ID: <169454023347.3411463.3256623887249978768.stg-ugh@frogsfrogsfrogs> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Hi Chandan, Please pull this branch with changes. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit ef7d9593390a050c50eba5fc02d2cb65a1104434: xfs: remove CPU hotplug infrastructure (2023-09-11 08:39:04 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-ro-mounts-6.6_2023-09-12 for you to fetch changes up to 74ad4693b6473950e971b3dc525b5ee7570e05d0: xfs: fix log recovery when unknown rocompat bits are set (2023-09-12 10:31:07 -0700) ---------------------------------------------------------------- xfs: fix ro mounting with unknown rocompat features [v2] Dave pointed out some failures in xfs/270 when he upgraded Debian unstable and util-linux started using the new mount apis. Upon further inquiry I noticed that XFS is quite a hot mess when it encounters a filesystem with unrecognized rocompat bits set in the superblock. Whereas we used to allow readonly mounts under these conditions, a change to the sb write verifier several years ago resulted in the filesystem going down immediately because the post-mount log cleaning writes the superblock, which trips the sb write verifier on the unrecognized rocompat bit. I made the observation that the ROCOMPAT features RMAPBT and REFLINK both protect new log intent item types, which means that we actually cannot support recovering the log if we don't recognize all the rocompat bits. Therefore -- fix inode inactivation to work when we're recovering the log, disallow recovery when there's unrecognized rocompat bits, and don't clean the log if doing so would trip the rocompat checks. v2: change direction of series to allow log recovery on ro mounts This has been lightly tested with fstests. Enjoy! Signed-off-by: Darrick J. Wong ---------------------------------------------------------------- Darrick J. Wong (2): xfs: allow inode inactivation during a ro mount log recovery xfs: fix log recovery when unknown rocompat bits are set fs/xfs/libxfs/xfs_sb.c | 3 ++- fs/xfs/xfs_inode.c | 14 ++++++++++---- fs/xfs/xfs_log.c | 17 ----------------- 3 files changed, 12 insertions(+), 22 deletions(-) From patchwork Tue Sep 12 17:39:51 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: 13381982 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 00DC2EE3F0A for ; Tue, 12 Sep 2023 17:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237108AbjILRj4 (ORCPT ); Tue, 12 Sep 2023 13:39:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236834AbjILRj4 (ORCPT ); Tue, 12 Sep 2023 13:39:56 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 800F910D3 for ; Tue, 12 Sep 2023 10:39:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06EA5C433CB; Tue, 12 Sep 2023 17:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694540392; bh=Gw1H5Zgp7y36Ew8Agq1DGWE87jEI7xTAxjv+aInnhBA=; h=Date:Subject:From:To:Cc:From; b=B/C2eamw0BXiRqN3Hyis0nBit5piHnArMnc+3+CcL8SHQsq3culTCkyWy9NyKx/nj uYqGfmKjrPXzAx2WloYkLgRwKz2i/zWX82vixb+mEmK70qi2YwGjm1382Xz9RnxrvD nWwyanfKgnG6fv5v9YgZ78iU1ynxEWZGuj9edC8RZALptvRP3TlU9C3HDz9/aLtlvQ cErUIXkLSYq6DHbmKJk8+EYt4hkRWhxPZQBjz5oqQ1vERZ7nMZVuqjqY/U3s2mcI9P iOX0qOJXN2mDdE9bBeWrIOq9ifT2V2ppwYHlcnqHYBV5jN5+ZtXmNSQQa9iGjRK2CA RdL/h8GSGJxKg== Date: Tue, 12 Sep 2023 10:39:51 -0700 Subject: [GIT PULL 4/8] xfs: fix EFI recovery livelocks From: "Darrick J. Wong" To: chandan.babu@gmail.com, djwong@kernel.org Cc: david@fromorbit.com, dchinner@redhat.com, linux-xfs@vger.kernel.org, srikanth.c.s@oracle.com, wen.gang.wang@oracle.com Message-ID: <169454023440.3411463.13931736328799093212.stg-ugh@frogsfrogsfrogs> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Hi Chandan, Please pull this branch with changes. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit 74ad4693b6473950e971b3dc525b5ee7570e05d0: xfs: fix log recovery when unknown rocompat bits are set (2023-09-12 10:31:07 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-efi-recovery-6.6_2023-09-12 for you to fetch changes up to 3c919b0910906cc69d76dea214776f0eac73358b: xfs: reserve less log space when recovering log intent items (2023-09-12 10:31:07 -0700) ---------------------------------------------------------------- xfs: fix EFI recovery livelocks This series fixes a customer-reported transaction reservation bug introduced ten years ago that could result in livelocks during log recovery. Log intent item recovery single-steps each step of a deferred op chain, which means that each step only needs to allocate one transaction's worth of space in the log, not an entire chain all at once. This single-stepping is critical to unpinning the log tail since there's nobody else to do it for us. This has been lightly tested with fstests. Enjoy! Signed-off-by: Darrick J. Wong ---------------------------------------------------------------- Darrick J. Wong (1): xfs: reserve less log space when recovering log intent items fs/xfs/libxfs/xfs_log_recover.h | 22 ++++++++++++++++++++++ fs/xfs/xfs_attr_item.c | 7 ++++--- fs/xfs/xfs_bmap_item.c | 4 +++- fs/xfs/xfs_extfree_item.c | 4 +++- fs/xfs/xfs_refcount_item.c | 6 ++++-- fs/xfs/xfs_rmap_item.c | 6 ++++-- 6 files changed, 40 insertions(+), 9 deletions(-) From patchwork Tue Sep 12 17:40:07 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: 13381983 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 F010EEE3F08 for ; Tue, 12 Sep 2023 17:40:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232725AbjILRkN (ORCPT ); Tue, 12 Sep 2023 13:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237163AbjILRkM (ORCPT ); Tue, 12 Sep 2023 13:40:12 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E23310D3 for ; Tue, 12 Sep 2023 10:40:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B810EC433C7; Tue, 12 Sep 2023 17:40:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694540407; bh=N4q3BUsDgryrPD5soZtx7mXP9wa6yek5B2LH7Ecj9to=; h=Date:Subject:From:To:Cc:From; b=Th60IFV7LCCBDKjjnel2v0D6E0IZy5FuFfi3qpZMmFbs+yIMDxcjKrD9krGFAYqBA JkTnCaz1zUdctM4wzGwmXBZCsr15D4Vhqp5mjuIqpGVFGAug/JoUWTXVS8Wr4aSQXw En0j3v6uqApHM2uHMQ8OQOZBNtDz+/tgbm2Q7j7x++jY17VBpg5+ZdRzytjgEQQlye 9uSoLnNintaX7oQcUmD4tJeel4jNrXxEiKSYL034zE9X5K9BmL2R4E7bH8SIs0K6Pb AtQuRwNj0Gc0VYM0GKVm8IOfJpjrdUyEr9Jb5ZmfSAVuOws/J8L86JH4A6sxDzUyuu /YTi2fXtkOH7g== Date: Tue, 12 Sep 2023 10:40:07 -0700 Subject: [GIT PULL 5/8] xfs: reload the last iunlink item From: "Darrick J. Wong" To: chandan.babu@gmail.com, djwong@kernel.org Cc: david@fromorbit.com, dchinner@redhat.com, linux-xfs@vger.kernel.org, sshegde@linux.vnet.ibm.com Message-ID: <169454023537.3411463.1875006072622672736.stg-ugh@frogsfrogsfrogs> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Hi Chandan, Please pull this branch with changes. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit 3c919b0910906cc69d76dea214776f0eac73358b: xfs: reserve less log space when recovering log intent items (2023-09-12 10:31:07 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-iunlink-6.6_2023-09-12 for you to fetch changes up to 68b957f64fca1930164bfc6d6d379acdccd547d7: xfs: load uncached unlinked inodes into memory on demand (2023-09-12 10:31:07 -0700) ---------------------------------------------------------------- xfs: reload the last iunlink item It turns out that there are some serious bugs in how xfs handles the unlinked inode lists. Way back before 4.14, there was a bug where a ro mount of a dirty filesystem would recover the log bug neglect to purge the unlinked list. This leads to clean unmounted filesystems with unlinked inodes. Starting around 5.15, we also converted the codebase to maintain a doubly-linked incore unlinked list. However, we never provided the ability to load the incore list from disk. If someone tries to allocate an O_TMPFILE file on a clean fs with a pre-existing unlinked list or even deletes a file, the code will fail and the fs shuts down. This first part of the correction effort adds the ability to load the first inode in the bucket when unlinking a file; and to load the next inode in the list when inactivating (freeing) an inode. This has been lightly tested with fstests. Enjoy! Signed-off-by: Darrick J. Wong ---------------------------------------------------------------- Darrick J. Wong (1): xfs: load uncached unlinked inodes into memory on demand fs/xfs/xfs_inode.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++---- fs/xfs/xfs_trace.h | 25 +++++++++++++++++ 2 files changed, 100 insertions(+), 5 deletions(-) From patchwork Tue Sep 12 17:40:22 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: 13381984 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 745A5EE3F08 for ; Tue, 12 Sep 2023 17:40:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236749AbjILRk2 (ORCPT ); Tue, 12 Sep 2023 13:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236766AbjILRk1 (ORCPT ); Tue, 12 Sep 2023 13:40:27 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C066210C9 for ; Tue, 12 Sep 2023 10:40:23 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6354BC433C7; Tue, 12 Sep 2023 17:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694540423; bh=jwNxtdBu3A5CRWBtcVR6NnaTR0rFOh5PwW3f5WQBYxs=; h=Date:Subject:From:To:Cc:From; b=YqQ3OZXzkVaN4ThgoCRMPkvTyQtrViAUALGdQ5Kqa7xo88DvEzF1SiJUT2rbmEvaO PbpKEn9M6q1CHhOJyyZxtV5Y7byl/+/AwEP9Bhg93WKNF6Ylnexkjw3B/q+5fHJbOG zus4RZ3iwGp3dRYrrP2cVhV41LpPLl5waS4zle3EFQj35LR+hCgn2R9jzzn7Hl/eok xtDgIyMuNOgsjhAh9jXPM9LpUBXZ1A+VTmgdYXvzN8xUMuRd+mwSlQOdfWgWVK2O9d wBk+RmwiPUrAodMvvaDPD9A36e5Ift/UWVCnwmGl4hS4Qo5EUYzsUtR4VROcuXlvsP thp0LFk/MJn/Q== Date: Tue, 12 Sep 2023 10:40:22 -0700 Subject: [GIT PULL 6/8] xfs: reload entire iunlink lists From: "Darrick J. Wong" To: chandan.babu@gmail.com, djwong@kernel.org Cc: david@fromorbit.com, linux-xfs@vger.kernel.org Message-ID: <169454023631.3411463.9021734328148221588.stg-ugh@frogsfrogsfrogs> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Hi Chandan, Please pull this branch with changes. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit 68b957f64fca1930164bfc6d6d379acdccd547d7: xfs: load uncached unlinked inodes into memory on demand (2023-09-12 10:31:07 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-iunlink-list-6.6_2023-09-12 for you to fetch changes up to 49813a21ed57895b73ec4ed3b99d4beec931496f: xfs: make inode unlinked bucket recovery work with quotacheck (2023-09-12 10:31:07 -0700) ---------------------------------------------------------------- xfs: reload entire iunlink lists This is the second part of correcting XFS to reload the incore unlinked inode list from the ondisk contents. Whereas part one tackled failures from regular filesystem calls, this part takes on the problem of needing to reload the entire incore unlinked inode list on account of somebody loading an inode that's in the /middle/ of an unlinked list. This happens during quotacheck, bulkstat, or even opening a file by handle. In this case we don't know the length of the list that we're reloading, so we don't want to create a new unbounded memory load while holding resources locked. Instead, we'll target UNTRUSTED iget calls to reload the entire bucket. Note that this changes the definition of the incore unlinked inode list slightly -- i_prev_unlinked == 0 now means "not on the incore list". This has been lightly tested with fstests. Enjoy! Signed-off-by: Darrick J. Wong ---------------------------------------------------------------- Darrick J. Wong (3): xfs: use i_prev_unlinked to distinguish inodes that are not on the unlinked list xfs: reload entire unlinked bucket lists xfs: make inode unlinked bucket recovery work with quotacheck fs/xfs/xfs_attr_inactive.c | 1 - fs/xfs/xfs_export.c | 6 +++ fs/xfs/xfs_icache.c | 2 +- fs/xfs/xfs_inode.c | 115 +++++++++++++++++++++++++++++++++++++++++++-- fs/xfs/xfs_inode.h | 34 +++++++++++++- fs/xfs/xfs_itable.c | 9 ++++ fs/xfs/xfs_mount.h | 10 +++- fs/xfs/xfs_qm.c | 7 +++ fs/xfs/xfs_trace.h | 20 ++++++++ 9 files changed, 195 insertions(+), 9 deletions(-) From patchwork Tue Sep 12 17:40:38 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: 13381985 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 CCB84EE3F08 for ; Tue, 12 Sep 2023 17:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236766AbjILRkn (ORCPT ); Tue, 12 Sep 2023 13:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236676AbjILRkn (ORCPT ); Tue, 12 Sep 2023 13:40:43 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A93C1 for ; Tue, 12 Sep 2023 10:40:39 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EBB4C433C7; Tue, 12 Sep 2023 17:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694540439; bh=14DMVqO0Z+VV+v1BRT/QqG0ZBqSJtT81TfzO+wuEgmc=; h=Date:Subject:From:To:Cc:From; b=FJ6+ngNKP/EO9PfuZI+Fa1iNI0ogWLP07FGK8C7OPtn05CG1YPbGjOlQbUpR9/NFQ MwyF436xR+RVc12DOYu3YR/nsRyQM1mzDgvCXJM1tDSmyoRLMgJFN3XxJHwoXg5xD4 88Cp+SCQ24CNcazS4gOpUvjjvCZlKn2G3m5ybe4Hv+R5qaCA2dzy+u3kQVXVX7iGRL zRXxWRyGq+ikKm9LW93aeBhZMT0pSWfCWVvws3RrApFie6aUWZgzAZe3FfAb1ViVLc wXwg23o4cJbFdlzViuNaW0MEaYpXlqzNJQMV/3ArO1WTbUQgdydbKreNWavCWCAEho mVbBu34skCIsw== Date: Tue, 12 Sep 2023 10:40:38 -0700 Subject: [GIT PULL 7/8] xfs: disallow LARP on old fses From: "Darrick J. Wong" To: chandan.babu@gmail.com, djwong@kernel.org Cc: bodonnel@redhat.com, linux-xfs@vger.kernel.org Message-ID: <169454023727.3411463.17582197078544277888.stg-ugh@frogsfrogsfrogs> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Hi Chandan, Please pull this branch with changes. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit 49813a21ed57895b73ec4ed3b99d4beec931496f: xfs: make inode unlinked bucket recovery work with quotacheck (2023-09-12 10:31:07 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-larp-requirements-6.6_2023-09-12 for you to fetch changes up to 34389616a963480b20ea7f997533380ae3946fba: xfs: require a relatively recent V5 filesystem for LARP mode (2023-09-12 10:31:08 -0700) ---------------------------------------------------------------- xfs: disallow LARP on old fses Before enabling logged xattrs, make sure the filesystem is new enough that it actually supports log incompat features. This has been lightly tested with fstests. Enjoy! Signed-off-by: Darrick J. Wong ---------------------------------------------------------------- Darrick J. Wong (1): xfs: require a relatively recent V5 filesystem for LARP mode fs/xfs/xfs_xattr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) From patchwork Tue Sep 12 17:40:54 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: 13381986 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 3D5D3EE3F08 for ; Tue, 12 Sep 2023 17:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbjILRk7 (ORCPT ); Tue, 12 Sep 2023 13:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236676AbjILRk7 (ORCPT ); Tue, 12 Sep 2023 13:40:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39EDC10C9 for ; Tue, 12 Sep 2023 10:40:55 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1AE0C433C8; Tue, 12 Sep 2023 17:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694540454; bh=DbGDAER0Z7tzuCrxKHF327iajSlJYhWeWoCdONPgLDA=; h=Date:Subject:From:To:Cc:From; b=ZZnA0TVVuJRymw/bZepgtEgFHhhBmwza0cFh49Yqia0a3cdiUsoptz1NjmNgV4TWw X9x1HLTjM63MD2yrGqjLQOxcZy5nZQk6KBjlcbPFDyo8qaPpIXDzF9T+wMr3eHBchu NEzq75Ry8TligUwjJH3SAdC4j9Dd8n092MUnLgGDUYochNY6qaEJquaQocmCI7lhjE 1ZEhpDofOlA8Onkov5o6GD3pFXZeM3U4r4Bfy4avL7tLgAe4wwn5jMpNV03rnRw/j9 mdOmCMuOq+PT3ZHj5Pi9XOVNIERfDKWs9om0Wn3wsBpM7DPwLAaeZm9xZrlP7JsyNw h/a/DHpMt2jng== Date: Tue, 12 Sep 2023 10:40:54 -0700 Subject: [GIT PULL 8/8] xfs: fix out of bounds memory access in scrub From: "Darrick J. Wong" To: chandan.babu@gmail.com, djwong@kernel.org Cc: david@fromorbit.com, dchinner@redhat.com, harshit.m.mogalapalli@oracle.com, linux-xfs@vger.kernel.org Message-ID: <169454023821.3411463.7740303846093140144.stg-ugh@frogsfrogsfrogs> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Hi Chandan, Please pull this branch with changes. As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems. --D The following changes since commit 34389616a963480b20ea7f997533380ae3946fba: xfs: require a relatively recent V5 filesystem for LARP mode (2023-09-12 10:31:08 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-scrub-6.6_2023-09-12 for you to fetch changes up to e03192820002feb064cc4fd0df9b8f0a94675c7d: xfs: only call xchk_stats_merge after validating scrub inputs (2023-09-12 10:31:08 -0700) ---------------------------------------------------------------- xfs: fix out of bounds memory access in scrub This is a quick fix for a few internal syzbot reports concerning an invalid memory access in the scrub code. This has been lightly tested with fstests. Enjoy! Signed-off-by: Darrick J. Wong ---------------------------------------------------------------- Darrick J. Wong (1): xfs: only call xchk_stats_merge after validating scrub inputs fs/xfs/scrub/scrub.c | 4 ++-- fs/xfs/scrub/stats.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-)