From: Ben Myers <bpm@sgi.com>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/2] xfs_repair: Properly set lost+found inode as used
Date: Mon, 14 Nov 2011 12:09:18 -0600 [thread overview]
Message-ID: <20111114180918.GC29840@sgi.com> (raw)
In-Reply-To: <1320857647-25511-3-git-send-email-cmaiolino@redhat.com>
Hey Carlos,
On Wed, Nov 09, 2011 at 02:54:07PM -0200, Carlos Maiolino wrote:
> This patch makes mk_orphanage() to properly set the inode link count of
> the recently allocated inode in the AVL tree, avoiding the lost+found
> directory to be bypass the link count check in phase7 and possibly leaving
> lost+found directory with a wrong link count.
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> repair/phase6.c | 18 +++++++++++++++++-
> 1 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/repair/phase6.c b/repair/phase6.c
> index adad61d..d38e44f 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -823,6 +823,8 @@ mk_orphanage(xfs_mount_t *mp)
> xfs_inode_t *ip;
> xfs_inode_t *pip;
> xfs_fsblock_t first;
> + ino_tree_node_t *irec;
> + int ino_offset = 0;
> int i;
> int committed;
> int error;
> @@ -875,6 +877,19 @@ mk_orphanage(xfs_mount_t *mp)
> ORPHANAGE, error);
> }
> ip->i_d.di_nlink++; /* account for . */
> + ino = ip->i_ino;
> +
> + irec = find_inode_rec(mp,
> + XFS_INO_TO_AGNO(mp, ino),
> + XFS_INO_TO_AGINO(mp, ino));
> + ino_offset = get_inode_offset(mp, ino, irec);
> +
> + /*
> + * Mark the inode allocated to lost+found as used in the AVL tree
> + * so it is not skipped in phase 7
> + */
> + set_inode_used(irec, ino_offset);
> + add_inode_ref(irec, ino_offset);
Both add_inode_ref()...
> /*
> * now that we know the transaction will stay around,
> @@ -902,6 +917,7 @@ mk_orphanage(xfs_mount_t *mp)
> XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rootino)), 0);
>
>
> +
> libxfs_trans_log_inode(tp, pip, XFS_ILOG_CORE);
> libxfs_dir_init(tp, ip, pip);
> libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
> @@ -912,9 +928,9 @@ mk_orphanage(xfs_mount_t *mp)
> ORPHANAGE, error);
> }
>
> - ino = ip->i_ino;
>
> libxfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_SYNC);
> + add_inode_reached(irec,ino_offset);
and add_inode_reached() call counted_nlink_inc.
I have to admit to being an xfs_repair newbie, so you can tell me to
take a hike if you want. Did you intend to bump up nlink twice?
THat's not what I would have expected.
THanks,
Ben
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-11-14 18:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 16:54 [PATCH 0/2] Set lost+found inode as used after its allocation Carlos Maiolino
2011-11-09 16:54 ` [PATCH 1/2] xfs_repair: Add inline function to get avl tree node Carlos Maiolino
2011-11-09 16:54 ` [PATCH 2/2] xfs_repair: Properly set lost+found inode as used Carlos Maiolino
2011-11-14 18:09 ` Ben Myers [this message]
2011-11-10 11:11 ` [PATCH 0/2] Set lost+found inode as used after its allocation Christoph Hellwig
2011-11-10 12:05 ` Carlos Maiolino
-- strict thread matches above, loose matches on Subject: below --
2011-11-08 18:46 Carlos Maiolino
2011-11-08 18:46 ` [PATCH 2/2] xfs_repair: Properly set lost+found inode as used Carlos Maiolino
2011-11-08 18:55 ` Eric Sandeen
2011-11-08 19:07 ` Christoph Hellwig
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=20111114180918.GC29840@sgi.com \
--to=bpm@sgi.com \
--cc=cmaiolino@redhat.com \
--cc=xfs@oss.sgi.com \
/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