All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH 5/5] xfs_repair: set proper ftype when moving to lost+found
Date: Sun,  7 Sep 2014 11:41:05 -0500	[thread overview]
Message-ID: <1410108065-18156-6-git-send-email-sandeen@redhat.com> (raw)
In-Reply-To: <1410108065-18156-1-git-send-email-sandeen@redhat.com>

When we move files to lost+found, we're setting the
filetype to UNKNOWN.  This leaves an inconsistency which
is discovered on a subsequent repair:

 would fix ftype mismatch (0/1) in directory/child inode 5838/5839

Setting the proper ftype at the time of the move
resolves this:

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 repair/phase6.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/repair/phase6.c b/repair/phase6.c
index cc36a9c..02714c2 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -1091,14 +1091,13 @@ mv_orphanage(
 	ino_tree_node_t		*irec;
 	int			ino_offset = 0;
 	struct xfs_name		xname;
+	__uint16_t		di_mode;
 
 	ASSERT(xfs_sb_version_hasdirv2(&mp->m_sb));
 
 	xname.name = fname;
 	xname.len = snprintf((char *)fname, sizeof(fname), "%llu",
 				(unsigned long long)ino);
-	/* XXX use xfs_mode_to_ftype[] when userspace gains it */
-	xname.type = XFS_DIR3_FT_UNKNOWN;
 
 	err = libxfs_iget(mp, NULL, orphanage_ino, 0, &orphanage_ip, 0);
 	if (err)
@@ -1117,6 +1116,10 @@ mv_orphanage(
 	if ((err = libxfs_iget(mp, NULL, ino, 0, &ino_p, 0)))
 		do_error(_("%d - couldn't iget disconnected inode\n"), err);
 
+	di_mode = ino_p->i_d.di_mode;
+	di_mode = (di_mode & S_IFMT) >> S_SHIFT;
+	xname.type = xfs_mode_to_ftype[di_mode];
+
 	if (isa_dir)  {
 		irec = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, orphanage_ino),
 				XFS_INO_TO_AGINO(mp, orphanage_ino));
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2014-09-07 16:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-07 16:41 [PATCH 0/5] xfs_repair fixes, part 1 Eric Sandeen
2014-09-07 16:41 ` [PATCH 1/5] xfs_repair: clear bad flgs in process_dinode_int Eric Sandeen
2014-09-08 13:45   ` Brian Foster
2014-09-09 22:28   ` Christoph Hellwig
2014-09-09 22:33     ` Eric Sandeen
2014-09-09 23:48       ` Dave Chinner
2014-09-07 16:41 ` [PATCH 2/5] xfs_repair: preserve error state in process_shortform_attr Eric Sandeen
2014-09-08 13:45   ` Brian Foster
2014-09-09 22:29   ` Christoph Hellwig
2014-09-07 16:41 ` [PATCH 3/5] xfs_repair: fix dir refcount when '.' missing and dir is rebuilt Eric Sandeen
2014-09-08 13:45   ` Brian Foster
2014-09-08 14:25     ` Brian Foster
2014-09-08 14:44       ` Eric Sandeen
2014-09-08 14:33     ` Eric Sandeen
2014-09-07 16:41 ` [PATCH 4/5] xfs_repair: don't ASSERT on corrupt ftype Eric Sandeen
2014-09-08  0:10   ` Dave Chinner
2014-09-08  1:02     ` Eric Sandeen
2014-09-08  3:16       ` Dave Chinner
2014-09-08  3:18         ` Eric Sandeen
2014-09-08  6:23           ` Dave Chinner
2014-09-07 16:41 ` Eric Sandeen [this message]
2014-09-07 21:26   ` [PATCH 5/5] xfs_repair: set proper ftype when moving to lost+found Eric Sandeen
2014-09-07 17:02 ` [PATCH 6/5] xfs_repair: don't re-add root dotdot if root dir was rebuilt Eric Sandeen

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=1410108065-18156-6-git-send-email-sandeen@redhat.com \
    --to=sandeen@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.