linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: do not log/recover swapext extent owner changes for deleted inodes
@ 2018-02-23 23:49 Eric Sandeen
  2018-02-26 16:39 ` Brian Foster
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Eric Sandeen @ 2018-02-23 23:49 UTC (permalink / raw)
  To: linux-xfs

Today if we run swapext and crash, log replay can fail because
the recovery code tries to instantiate the donor inode from
disk to replay the swapext, but it's been deleted and we throw
corruption failures if we try to get an inode off disk with
i_mode == 0.

This fixes both sides: We don't log the swapext change if the
inode has been deleted, and we don't try to recover it either.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 26f2413..de48eb8 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -436,6 +436,12 @@ xfs_inode_item_format(
 			~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT);
 	}
 
+	/* If this inode has been deleted do not log swapext owner changes */
+	if (VFS_I(ip)->i_mode == 0) {
+		ilf->ilf_fields &= ~(XFS_ILOG_DOWNER | XFS_ILOG_AOWNER);
+		iip->ili_fields &= ~(XFS_ILOG_DOWNER | XFS_ILOG_AOWNER);
+	}
+
 	/* update the format with the exact fields we actually logged */
 	ilf->ilf_fields |= (iip->ili_fields & ~XFS_ILOG_TIMESTAMP);
 }
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 5e219d9..d0e33b9 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3199,7 +3199,9 @@ xlog_recover_inode_pass2(
 	}
 
 out_owner_change:
-	if (in_f->ilf_fields & (XFS_ILOG_DOWNER|XFS_ILOG_AOWNER))
+	/* Recover the swapext owner change unless inode has been deleted */
+	if ((in_f->ilf_fields & (XFS_ILOG_DOWNER|XFS_ILOG_AOWNER)) &&
+	    (dip->di_mode != 0))
 		error = xfs_recover_inode_owner_change(mp, dip, in_f,
 						       buffer_list);
 	/* re-generate the checksum. */


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-03-29 13:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-23 23:49 [PATCH] xfs: do not log/recover swapext extent owner changes for deleted inodes Eric Sandeen
2018-02-26 16:39 ` Brian Foster
2018-02-26 20:56   ` Brian Foster
2018-03-07 19:58     ` Eric Sandeen
2018-03-08 19:46       ` Brian Foster
2018-03-24  0:13 ` [PATCH V2] xfs: do not log " Eric Sandeen
2018-03-24  1:03   ` Darrick J. Wong
2018-03-26 12:13   ` Brian Foster
2018-03-26 13:37     ` Eric Sandeen
2018-03-28 22:12 ` [PATCH V3] xfs: do not log/recover " Eric Sandeen
2018-03-29 13:19   ` Brian Foster
2018-03-29 13:26     ` Eric Sandeen

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).