linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, Arkadiusz Miskiewicz <arekm@maven.pl>
Subject: [PATCH 04/10] libxfs: retain ifork_ops when flushing inode
Date: Mon, 22 Apr 2019 08:45:15 -0700	[thread overview]
Message-ID: <155594791533.115924.7540619376750686973.stgit@magnolia> (raw)
In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Retain the ifork ops used to validate the inode so that we can use the
same one to iflush it.  xfs_repair phase 6 can use multiple transactions
to fix various inode problems, which means that the inode might not be
fully fixed when each transaction commits.

This can be a particular problem if there's a shortform directory with
both invalid directory entries and incorrect i8count.  Phase 3 will set
the parent inode to "0" to signal to phase 6 that it needs to reset the
parent and i8count, but phase 6 starts a transaction to junk the bad
entries which fail to commit because the parent is invalid:

fixing i8count in inode 69022994673
Invalid inode number 0x0
xfs_dir_ino_validate: XFS_ERROR_REPORT
Metadata corruption detected at 0x464eb0, inode 0x10121750f1 data fork
xfs_repair: warning - iflush_int failed (-117)

And thus the inode fixes never get written out.

Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 include/xfs_inode.h |    1 +
 libxfs/rdwr.c       |    1 +
 libxfs/util.c       |    2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)


diff --git a/include/xfs_inode.h b/include/xfs_inode.h
index 79ec3a2d..e1e8b430 100644
--- a/include/xfs_inode.h
+++ b/include/xfs_inode.h
@@ -51,6 +51,7 @@ typedef struct xfs_inode {
 
 	xfs_fsize_t		i_size;		/* in-memory size */
 	const struct xfs_dir_ops *d_ops;	/* directory ops vector */
+	struct xfs_ifork_ops	*i_fork_ops;	/* fork verifiers */
 	struct inode		i_vnode;
 } xfs_inode_t;
 
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index a00360e7..69d5abb2 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -1391,6 +1391,7 @@ libxfs_iget(
 		return error;
 	}
 
+	ip->i_fork_ops = ifork_ops;
 	if (!libxfs_inode_verify_forks(ip, ifork_ops)) {
 		libxfs_irele(ip);
 		return -EFSCORRUPTED;
diff --git a/libxfs/util.c b/libxfs/util.c
index 4ac151e6..2e3b9d51 100644
--- a/libxfs/util.c
+++ b/libxfs/util.c
@@ -422,7 +422,7 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp)
 		VFS_I(ip)->i_version++;
 
 	/* Check the inline fork data before we write out. */
-	if (!libxfs_inode_verify_forks(ip, &xfs_default_ifork_ops))
+	if (!libxfs_inode_verify_forks(ip, ip->i_fork_ops))
 		return -EFSCORRUPTED;
 
 	/*

  parent reply	other threads:[~2019-04-22 15:45 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 15:44 [PATCH v3 00/10] xfsprogs-5.0: fix various problems Darrick J. Wong
2019-04-22 15:44 ` [PATCH 01/10] scrub: fix Makefile targets which depend on builddefs Darrick J. Wong
2019-04-22 18:27   ` Eric Sandeen
2019-04-22 18:28   ` Bill O'Donnell
2019-04-22 15:45 ` [PATCH 02/10] xfs_info: use findmnt to handle mounted block devices Darrick J. Wong
2019-04-22 18:35   ` Eric Sandeen
2019-04-22 19:27   ` Bill O'Donnell
2019-04-22 15:45 ` [PATCH 03/10] xfs_repair: correctly account for free space btree shrinks when fixing freelist Darrick J. Wong
2019-04-22 19:24   ` Eric Sandeen
2019-04-22 19:36   ` Bill O'Donnell
2019-04-22 15:45 ` Darrick J. Wong [this message]
2019-04-22 19:40   ` [PATCH 04/10] libxfs: retain ifork_ops when flushing inode Bill O'Donnell
2019-04-22 19:45   ` Eric Sandeen
2019-10-02  6:00   ` Arkadiusz Miśkiewicz
2019-04-22 15:45 ` [PATCH 05/10] libxfs: drop the ifork_ops parameter from _inode_verify_forks Darrick J. Wong
2019-04-22 19:43   ` Bill O'Donnell
2019-04-22 20:49   ` Eric Sandeen
2019-04-22 15:45 ` [PATCH 06/10] misc: fix strncpy length complaints Darrick J. Wong
2019-04-22 20:48   ` Eric Sandeen
2019-04-22 20:57     ` Darrick J. Wong
2019-04-22 21:04       ` Eric Sandeen
2019-04-22 21:07   ` Eric Sandeen
2019-04-23 15:07   ` Bill O'Donnell
2019-04-22 15:45 ` [PATCH 07/10] libxfs: refactor buffer item release code Darrick J. Wong
2019-04-22 21:26   ` Eric Sandeen
2019-04-22 21:35     ` Darrick J. Wong
2019-04-22 21:40       ` Eric Sandeen
2019-04-23 20:51   ` [PATCH v2 " Darrick J. Wong
2019-04-23 20:56     ` Bill O'Donnell
2019-04-22 15:45 ` [PATCH 08/10] libxfs: don't touch buffer log item pointer when flushing inode log item Darrick J. Wong
2019-04-23 17:56   ` Eric Sandeen
2019-04-23 20:52   ` Bill O'Donnell
2019-04-22 15:45 ` [PATCH 09/10] libxfs: fix buffer log item lifetime weirdness Darrick J. Wong
2019-04-23 21:15   ` Bill O'Donnell
2019-04-22 15:45 ` [PATCH 10/10] libxfs: shorten inode item lifetime Darrick J. Wong
2019-04-23 21:22   ` Bill O'Donnell
2019-04-23 21:04 ` [PATCH 11/10] libfrog: fix memory leak in bitmap_free Darrick J. Wong
2019-04-23 21:23   ` Bill O'Donnell

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=155594791533.115924.7540619376750686973.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=arekm@maven.pl \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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).