From patchwork Mon Dec 23 21:36:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13919230 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 34818161328 for ; Mon, 23 Dec 2024 21:36:36 +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=1734989797; cv=none; b=aGFHCxvrwfyGiIfpvSlSRuWnGJQ+SGHaoCzRaBgu1peu1pnmm8j8eGaTK7KWLgU0izdgu5aMyG9m3pVSIO8odIoFl40rGFlTgrZWxoOa1DVxiAgPX4tztgmnWd3pVDWiYXFAMJswzwza1jiZyhwZTD4fZWID8nNTodrp1fDrOPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734989797; c=relaxed/simple; bh=Lor96sr8a7W4fml9/CVYkyXthMkAIJuyZ/GFA/TNVe8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LaKxiW/tDQ0kqwdRjN/8Zd9YXzqihmxInDojk1fZ63voMQDZFruo9DGJj9dl/kGEhqNlcRgLDoYjoFYoM9kOOY3Fn8PE2m3LbBC7hGgBa2GZuFvuTGLYJJMJMtij5Zj/5JT8yeWIrh4u7AJbIkRns+oyEz8wD3LKuxiB2PyzMVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M72rL+UA; 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="M72rL+UA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C59C4CED3; Mon, 23 Dec 2024 21:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734989796; bh=Lor96sr8a7W4fml9/CVYkyXthMkAIJuyZ/GFA/TNVe8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=M72rL+UAbhTmETqxkCZpnmMUeEBLsvPctPMWSPGOckyJquwfSPSl3M+qbdmqohNRW XuiaXbCSBDQ1KPVQVFxoPfPL6eB9U93/DcZE8WlpuG1Imm+OZFXWublUQqAKVgqwZZ 9atR3x9bhs/TzGrwZUQ0V6UaiRjRJiYjBbv6RYtO2ohmBuD7J8cVKl+miNF7pG3u4P nK8DlvRwf9XcOIzWSft5ZKGBQwARxwMDjk7smOs13ijF48ooZzw5TxOUK3xtjr6J6L U4BlDnfYN5f3rW1UaV+2dUbNW8FRbUVwuQTQj+OFHd66Uxb2QfuOY0CTzdxqu/c+bA rwGM9ObIQ7vLA== Date: Mon, 23 Dec 2024 13:36:36 -0800 Subject: [PATCH 1/3] xfs_repair: fix maximum file offset comparison From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <173498939497.2292884.2235886667157405986.stgit@frogsfrogsfrogs> In-Reply-To: <173498939477.2292884.7220593538958401281.stgit@frogsfrogsfrogs> References: <173498939477.2292884.7220593538958401281.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong When running generic/525 with rtinherit=1 and rextsize=28k, generic/525 trips over the following block mapping: data offset 2251799813685247 startblock 7 (0/7) count 1 flag 0 data offset 2251799813685248 startblock 8 (0/8) count 6 flag 1 with this error: inode 155 - extent exceeds max offset - start 2251799813685248, count 6, physical block 8 This is due to an incorrect check in xfs_repair, which tries to validate that a block mapping cannot exceed what it thinks is the maximum file offset. Unfortunately, the check is wrong, because only br_startoff is subject to the 2^52-1 limit -- not br_startoff + br_blockcount. Nowadays libxfs provides a symbol XFS_MAX_FILEOFF for the maximum allowable file block offset that can be mapped into a file. Use this instead of the open-coded logic in versions.c and correct all the other checks. Note that this problem only surfaced when rtgroups were enabled because hch changed xfs_repair to use the same tree-based block state data structure that we use for AGs when rtgroups are enabled. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- repair/dinode.c | 2 +- repair/globals.c | 1 - repair/globals.h | 1 - repair/prefetch.c | 2 +- repair/versions.c | 7 +------ 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/repair/dinode.c b/repair/dinode.c index ac81c487a20b8a..2c9d9acfa10be5 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -491,7 +491,7 @@ _("inode %" PRIu64 " - bad extent overflows - start %" PRIu64 ", " } /* Ensure this extent does not extend beyond the max offset */ if (irec.br_startoff + irec.br_blockcount - 1 > - fs_max_file_offset) { + XFS_MAX_FILEOFF) { do_warn( _("inode %" PRIu64 " - extent exceeds max offset - start %" PRIu64 ", " "count %" PRIu64 ", physical block %" PRIu64 "\n"), diff --git a/repair/globals.c b/repair/globals.c index c0c45df51d562a..7388090a7d39f3 100644 --- a/repair/globals.c +++ b/repair/globals.c @@ -83,7 +83,6 @@ int inodes_per_block; unsigned int glob_agcount; int chunks_pblock; /* # of 64-ino chunks per allocation */ int max_symlink_blocks; -int64_t fs_max_file_offset; /* realtime info */ diff --git a/repair/globals.h b/repair/globals.h index 1eadfdbf9ae4f2..fa53502f98bbcd 100644 --- a/repair/globals.h +++ b/repair/globals.h @@ -124,7 +124,6 @@ extern int inodes_per_block; extern unsigned int glob_agcount; extern int chunks_pblock; /* # of 64-ino chunks per allocation */ extern int max_symlink_blocks; -extern int64_t fs_max_file_offset; /* realtime info */ diff --git a/repair/prefetch.c b/repair/prefetch.c index 0772ecef9d73eb..5ecf19ae9cb111 100644 --- a/repair/prefetch.c +++ b/repair/prefetch.c @@ -185,7 +185,7 @@ pf_read_bmbt_reclist( if (((i > 0) && (op + cp > irec.br_startoff)) || (irec.br_blockcount == 0) || - (irec.br_startoff >= fs_max_file_offset)) + (irec.br_startoff + irec.br_blockcount - 1 >= XFS_MAX_FILEOFF)) goto out_free; if (!libxfs_verify_fsbno(mp, irec.br_startblock) || diff --git a/repair/versions.c b/repair/versions.c index b24965b263a183..7dc91b4597eece 100644 --- a/repair/versions.c +++ b/repair/versions.c @@ -180,10 +180,5 @@ _("WARNING: you have a V1 inode filesystem. It would be converted to a\n" fs_ino_alignment = mp->m_sb.sb_inoalignmt; } - /* - * calculate maximum file offset for this geometry - */ - fs_max_file_offset = 0x7fffffffffffffffLL >> mp->m_sb.sb_blocklog; - - return(0); + return 0; } From patchwork Mon Dec 23 21:36:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13919231 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 C62F538F82 for ; Mon, 23 Dec 2024 21:36:52 +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=1734989812; cv=none; b=kvAyDcmpk2dzeXV2QRKhLfnMhdJ5gVY/Vo3Rc7m6aZ21MwYHVtaytZ9IP6F3iSm/PwGnDUZKQzQ8YyetZSJb5XwrgTzmKjKtw6JwYM4RCs90vo0WrygU1wxzn7PnvdND6V8UzJyuW2tUaX3e46itOGaCChsCMWnUP8UD389pIDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734989812; c=relaxed/simple; bh=r4LRIVltITO21AbPivmzhRo80jBA8npW90ONb+XUkYY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TUAdLTeG1Gpn1PwqFXRNsmPGW2uUaUpAsCnfQyjZE8vULhCytbos78XwEBJqm2Rdy19aACd/f6sboIfUy3AUMU3marhO+7qZa8hsfh1pUdZfvoAERt8I8t1ZNeosDQ3vz1aL1gx5HfVlB7CvaPG3X5M9iTlSXjHXT7I2vErCtCs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t64C6Mte; 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="t64C6Mte" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6115FC4CED3; Mon, 23 Dec 2024 21:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734989812; bh=r4LRIVltITO21AbPivmzhRo80jBA8npW90ONb+XUkYY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=t64C6Mtex75gIdFNHz4UEI0HGtWzX0g0Z5dhBFaQGK7NXwROgYwCEUCp/PyBXUdTW OJOGdsvv5m+w8BLEi6kB4mDIJyA4UWBytD2ORigts0FUg2BekN0enQHevaVf6RMJ5l 32DAvjeoxdNVys34uwDv873zCVpkGVSJjkRQ5MaTNw9fvwFAgRGSsN2RB6FDISKmEK qs9rVV+20uwAhdYqr8Z/wxurTLquADf05moPdPp236XdJ05JvG1bu1i4cRBwvWpEhJ kJORLfboHbBQQaWAnYtiARJBIpVS/4LPrQ6iY22/+QTJws9PYTU0pz9k0x2Fjtp6Ji lSyTAgktHh14g== Date: Mon, 23 Dec 2024 13:36:51 -0800 Subject: [PATCH 2/3] man: fix ioctl_xfs_commit_range man page install From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: jpalus@fastmail.com, linux-xfs@vger.kernel.org Message-ID: <173498939512.2292884.4133253243786267430.stgit@frogsfrogsfrogs> In-Reply-To: <173498939477.2292884.7220593538958401281.stgit@frogsfrogsfrogs> References: <173498939477.2292884.7220593538958401281.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Jan Palus INSTALL_MAN uses first symbol in .SH NAME section for both source and destination filename hence it needs to match current filename. since ioctl_xfs_commit_range.2 documents both ioctl_xfs_start_commit as well as ioctl_xfs_commit_range ensure they are listed in order INSTALL_MAN expects. Signed-off-by: Jan Palus Reviewed-by: "Darrick J. Wong" Signed-off-by: "Darrick J. Wong" --- man/man2/ioctl_xfs_commit_range.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man2/ioctl_xfs_commit_range.2 b/man/man2/ioctl_xfs_commit_range.2 index 3244e52c3e0946..4cd074ed00c6f2 100644 --- a/man/man2/ioctl_xfs_commit_range.2 +++ b/man/man2/ioctl_xfs_commit_range.2 @@ -22,8 +22,8 @@ .\" %%%LICENSE_END .TH IOCTL-XFS-COMMIT-RANGE 2 2024-02-18 "XFS" .SH NAME -ioctl_xfs_start_commit \- prepare to exchange the contents of two files ioctl_xfs_commit_range \- conditionally exchange the contents of parts of two files +ioctl_xfs_start_commit \- prepare to exchange the contents of two files .SH SYNOPSIS .br .B #include From patchwork Mon Dec 23 21:37:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13919232 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 6BC8B38F82 for ; Mon, 23 Dec 2024 21:37:08 +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=1734989828; cv=none; b=CdFYJHHpQH+h17wqLMUQ69YWzFLjOLwNiiA3vFbEA3UUAQZR69qLCvfiYmvGbpZgpGqS/Ix9t3fSxvkpUe5NprcoOt4kKLv6N5jNhztvh0Bn/jj0fk2mU/B/izQpJxJoY/j952loZo49jaTh6RrBTeiE61w5n/PwaFV7ixPq7Jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734989828; c=relaxed/simple; bh=fchwwvVta9wTjCYlPokRdtjaSayY04I+x3pnSR793zY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hzGXFIUqwcdAXTKCngT7gt0jVwc56SmNtTrU+j21uZqTRC51Zx72XwPUXyXTamLagxr0fjJfE/TQ6cRemeP1t0Js1AlM5YweCLoiUdvcoAFxrLT8VM3Una+thskja2aeBo8uwEZVBbT74H4oKiJeeQD1CyHn/bEpIqA4JpcbCZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IoJC0VPF; 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="IoJC0VPF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05598C4CED3; Mon, 23 Dec 2024 21:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734989828; bh=fchwwvVta9wTjCYlPokRdtjaSayY04I+x3pnSR793zY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=IoJC0VPFyrICifzf4xO/H8Z50cqWnyqejyowY9+hQwuzszj8DnC+JC+atPbf3bJXx seeJQhiOQqtQzJzVbClsBxJpoyYarvZQYhbUjEmxyQvEMs7FbrbWFBsdzhJVHWFIW+ Q61rrD3FfS9PIwLsgq2EzEBKvn2CP9AXazbF5azQGdM78vOE9qYemBsZdcNq7IeEqz v8w7+hhYMfscmzLkAG9c6RUdJjwrcJKJyHb+ccjZEPzpWv42iH6kkM6oFc9zRcgvrN XBLYrwMZrl2H7/F91NPq+obOmEuausnidKMmwL/TjF+HbFaXJ277eaJBv/unSpTjI7 NI6avVb74K7ZQ== Date: Mon, 23 Dec 2024 13:37:07 -0800 Subject: [PATCH 3/3] man: document the -n parent mkfs option From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <173498939527.2292884.14700159259964798040.stgit@frogsfrogsfrogs> In-Reply-To: <173498939477.2292884.7220593538958401281.stgit@frogsfrogsfrogs> References: <173498939477.2292884.7220593538958401281.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Document the -n parent option to mkfs.xfs so that users will actually know how to turn on directory parent pointers. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- man/man8/mkfs.xfs.8.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/man/man8/mkfs.xfs.8.in b/man/man8/mkfs.xfs.8.in index a854b0e87cb1a2..e56c8f31a52c78 100644 --- a/man/man8/mkfs.xfs.8.in +++ b/man/man8/mkfs.xfs.8.in @@ -902,6 +902,18 @@ .SH OPTIONS enabled, and cannot be turned off. .IP In other words, this option is only tunable on the deprecated V4 format. +.TP +.BI parent= value +This feature creates back references from child files to parent directories +so that online repair can reconstruct broken directory files. +The value is either 0 to disable the feature, or 1 to create parent pointers. + +By default, +.B mkfs.xfs +will not create parent pointers. +This feature is only available for filesystems created with the (default) +.B \-m crc=1 +option set. .RE .PP .PD 0