Commit dc1baa71 authored by Eric Sandeen's avatar Eric Sandeen Committed by Darrick J. Wong
Browse files

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: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 72c44e35
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -2475,6 +2475,10 @@ xfs_ifree(
	ip->i_d.di_forkoff = 0;		/* mark the attr fork not in use */
	ip->i_d.di_forkoff = 0;		/* mark the attr fork not in use */
	ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
	ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
	ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
	ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;

	/* Don't attempt to replay owner changes for a deleted inode */
	ip->i_itemp->ili_fields &= ~(XFS_ILOG_AOWNER|XFS_ILOG_DOWNER);

	/*
	/*
	 * Bump the generation count so no one will be confused
	 * Bump the generation count so no one will be confused
	 * by reincarnations of this inode.
	 * by reincarnations of this inode.
+3 −1
Original line number Original line Diff line number Diff line
@@ -3245,7 +3245,9 @@ xlog_recover_inode_pass2(
	}
	}


out_owner_change:
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,
		error = xfs_recover_inode_owner_change(mp, dip, in_f,
						       buffer_list);
						       buffer_list);
	/* re-generate the checksum. */
	/* re-generate the checksum. */