aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2018-03-28 20:48:08 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2018-03-29 13:19:15 -0400
commitdc1baa715bbfbb1902da942d06497e79b40e7bc7 (patch)
treeb36dbcf78a250483195788279ae23f5c6a5a8bb7
parent72c44e35f02a1cb4032e476c398a7234badcf49f (diff)
xfs: do not log/recover swapext extent owner changes for deleted inodes
Today if we run xfs_fsr and crash[1], 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 get verifier failures when we try to read the 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. [1] or if systemd doesn't cleanly unmount root, as it is wont to do ... Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r--fs/xfs/xfs_inode.c4
-rw-r--r--fs/xfs/xfs_log_recover.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 09ba970c07b1..3e3aab3888fa 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2475,6 +2475,10 @@ xfs_ifree(
2475 ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */ 2475 ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */
2476 ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS; 2476 ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
2477 ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; 2477 ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
2478
2479 /* Don't attempt to replay owner changes for a deleted inode */
2480 ip->i_itemp->ili_fields &= ~(XFS_ILOG_AOWNER|XFS_ILOG_DOWNER);
2481
2478 /* 2482 /*
2479 * Bump the generation count so no one will be confused 2483 * Bump the generation count so no one will be confused
2480 * by reincarnations of this inode. 2484 * by reincarnations of this inode.
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 59134f626927..2b2383f1895e 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3245,7 +3245,9 @@ xlog_recover_inode_pass2(
3245 } 3245 }
3246 3246
3247out_owner_change: 3247out_owner_change:
3248 if (in_f->ilf_fields & (XFS_ILOG_DOWNER|XFS_ILOG_AOWNER)) 3248 /* Recover the swapext owner change unless inode has been deleted */
3249 if ((in_f->ilf_fields & (XFS_ILOG_DOWNER|XFS_ILOG_AOWNER)) &&
3250 (dip->di_mode != 0))
3249 error = xfs_recover_inode_owner_change(mp, dip, in_f, 3251 error = xfs_recover_inode_owner_change(mp, dip, in_f,
3250 buffer_list); 3252 buffer_list);
3251 /* re-generate the checksum. */ 3253 /* re-generate the checksum. */