From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/4] repair: remove custom dir2 sf fork verifier from phase6
Date: Mon, 20 Jul 2020 17:47:44 -0700 [thread overview]
Message-ID: <20200721004744.GW3151642@magnolia> (raw)
In-Reply-To: <20200715140836.10197-5-bfoster@redhat.com>
On Wed, Jul 15, 2020 at 10:08:36AM -0400, Brian Foster wrote:
> The custom verifier exists to catch the case of repair setting a
> dummy parent value of zero on directory inodes and temporarily
> replace it with a valid inode number so the rest of the directory
> verification can proceed. The custom verifier is no longer needed
> now that the rootino is used as a dummy value for invalid on-disk
> parent values.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
More or less the same code that's in my tree...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> repair/phase6.c | 56 ++-----------------------------------------------
> 1 file changed, 2 insertions(+), 54 deletions(-)
>
> diff --git a/repair/phase6.c b/repair/phase6.c
> index beceea9a..43bcea50 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -26,58 +26,6 @@ static struct xfs_name xfs_name_dot = {(unsigned char *)".",
> 1,
> XFS_DIR3_FT_DIR};
>
> -/*
> - * When we're checking directory inodes, we're allowed to set a directory's
> - * dotdot entry to zero to signal that the parent needs to be reconnected
> - * during phase 6. If we're handling a shortform directory the ifork
> - * verifiers will fail, so temporarily patch out this canary so that we can
> - * verify the rest of the fork and move on to fixing the dir.
> - */
> -static xfs_failaddr_t
> -phase6_verify_dir(
> - struct xfs_inode *ip)
> -{
> - struct xfs_mount *mp = ip->i_mount;
> - struct xfs_ifork *ifp;
> - struct xfs_dir2_sf_hdr *sfp;
> - xfs_failaddr_t fa;
> - xfs_ino_t old_parent;
> - bool parent_bypass = false;
> - int size;
> -
> - ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
> - sfp = (struct xfs_dir2_sf_hdr *)ifp->if_u1.if_data;
> - size = ifp->if_bytes;
> -
> - /*
> - * If this is a shortform directory, phase4 may have set the parent
> - * inode to zero to indicate that it must be fixed. Temporarily
> - * set a valid parent so that the directory verifier will pass.
> - */
> - if (size > offsetof(struct xfs_dir2_sf_hdr, parent) &&
> - size >= xfs_dir2_sf_hdr_size(sfp->i8count)) {
> - old_parent = libxfs_dir2_sf_get_parent_ino(sfp);
> - if (old_parent == 0) {
> - libxfs_dir2_sf_put_parent_ino(sfp, mp->m_sb.sb_rootino);
> - parent_bypass = true;
> - }
> - }
> -
> - fa = libxfs_default_ifork_ops.verify_dir(ip);
> -
> - /* Put it back. */
> - if (parent_bypass)
> - libxfs_dir2_sf_put_parent_ino(sfp, old_parent);
> -
> - return fa;
> -}
> -
> -static struct xfs_ifork_ops phase6_ifork_ops = {
> - .verify_attr = xfs_attr_shortform_verify,
> - .verify_dir = phase6_verify_dir,
> - .verify_symlink = xfs_symlink_shortform_verify,
> -};
> -
> /*
> * Data structures used to keep track of directories where the ".."
> * entries are updated. These must be rebuilt after the initial pass
> @@ -1104,7 +1052,7 @@ mv_orphanage(
> (unsigned long long)ino, ++incr);
>
> /* Orphans may not have a proper parent, so use custom ops here */
> - err = -libxfs_iget(mp, NULL, ino, 0, &ino_p, &phase6_ifork_ops);
> + err = -libxfs_iget(mp, NULL, ino, 0, &ino_p, &xfs_default_ifork_ops);
> if (err)
> do_error(_("%d - couldn't iget disconnected inode\n"), err);
>
> @@ -2875,7 +2823,7 @@ process_dir_inode(
>
> ASSERT(!is_inode_refchecked(irec, ino_offset) || dotdot_update);
>
> - error = -libxfs_iget(mp, NULL, ino, 0, &ip, &phase6_ifork_ops);
> + error = -libxfs_iget(mp, NULL, ino, 0, &ip, &xfs_default_ifork_ops);
> if (error) {
> if (!no_modify)
> do_error(
> --
> 2.21.3
>
prev parent reply other threads:[~2020-07-21 0:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-15 14:08 [PATCH 0/4] xfsprogs: remove custom dir2 sf fork verifier from repair Brian Foster
2020-07-15 14:08 ` [PATCH 1/4] repair: set the in-core inode parent in phase 3 Brian Foster
2020-07-15 18:42 ` Christoph Hellwig
2020-07-21 0:57 ` Darrick J. Wong
2020-07-15 14:08 ` [PATCH 2/4] repair: don't double check dir2 sf parent in phase 4 Brian Foster
2020-07-15 18:43 ` Christoph Hellwig
2020-07-15 23:54 ` Darrick J. Wong
2020-07-16 10:39 ` Brian Foster
2020-07-21 0:55 ` Darrick J. Wong
2020-07-15 14:08 ` [PATCH 3/4] repair: use fs root ino for dummy parent value instead of zero Brian Foster
2020-07-15 18:44 ` Christoph Hellwig
2020-07-15 22:22 ` Dave Chinner
2020-07-16 10:41 ` Brian Foster
2020-07-16 22:06 ` Dave Chinner
2020-07-17 11:57 ` Brian Foster
2020-07-17 11:59 ` [PATCH v2] repair: use fs rootino " Brian Foster
2020-07-20 3:21 ` Dave Chinner
2020-07-21 0:47 ` Darrick J. Wong
2020-07-15 14:08 ` [PATCH 4/4] repair: remove custom dir2 sf fork verifier from phase6 Brian Foster
2020-07-15 18:44 ` Christoph Hellwig
2020-07-21 0:47 ` Darrick J. Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200721004744.GW3151642@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).