Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6f990d1 authored by Dave Chinner's avatar Dave Chinner Committed by Alex Elder
Browse files

xfs: handle CIl transaction commit failures correctly



Failure to commit a transaction into the CIL is not handled
correctly. This currently can only happen when racing with a
shutdown and requires an explicit shutdown check, so it rare and can
be avoided. Remove the shutdown check and make the CIL commit a void
function to indicate it will always succeed, thereby removing the
incorrectly handled failure case.

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
parent 5315837d
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -191,7 +191,7 @@ void xfs_log_ticket_put(struct xlog_ticket *ticket);


xlog_tid_t xfs_log_get_trans_ident(struct xfs_trans *tp);
xlog_tid_t xfs_log_get_trans_ident(struct xfs_trans *tp);


int	xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp,
void	xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp,
				struct xfs_log_vec *log_vector,
				struct xfs_log_vec *log_vector,
				xfs_lsn_t *commit_lsn, int flags);
				xfs_lsn_t *commit_lsn, int flags);
bool	xfs_log_item_in_current_chkpt(struct xfs_log_item *lip);
bool	xfs_log_item_in_current_chkpt(struct xfs_log_item *lip);
+1 −7
Original line number Original line Diff line number Diff line
@@ -625,7 +625,7 @@ out_abort:
 * background commit, returns without it held once background commits are
 * background commit, returns without it held once background commits are
 * allowed again.
 * allowed again.
 */
 */
int
void
xfs_log_commit_cil(
xfs_log_commit_cil(
	struct xfs_mount	*mp,
	struct xfs_mount	*mp,
	struct xfs_trans	*tp,
	struct xfs_trans	*tp,
@@ -640,11 +640,6 @@ xfs_log_commit_cil(
	if (flags & XFS_TRANS_RELEASE_LOG_RES)
	if (flags & XFS_TRANS_RELEASE_LOG_RES)
		log_flags = XFS_LOG_REL_PERM_RESERV;
		log_flags = XFS_LOG_REL_PERM_RESERV;


	if (XLOG_FORCED_SHUTDOWN(log)) {
		xlog_cil_free_logvec(log_vector);
		return XFS_ERROR(EIO);
	}

	/*
	/*
	 * do all the hard work of formatting items (including memory
	 * do all the hard work of formatting items (including memory
	 * allocation) outside the CIL context lock. This prevents stalling CIL
	 * allocation) outside the CIL context lock. This prevents stalling CIL
@@ -704,7 +699,6 @@ xfs_log_commit_cil(
	 */
	 */
	if (push)
	if (push)
		xlog_cil_push(log, 0);
		xlog_cil_push(log, 0);
	return 0;
}
}


/*
/*
+1 −4
Original line number Original line Diff line number Diff line
@@ -1755,7 +1755,6 @@ xfs_trans_commit_cil(
	int			flags)
	int			flags)
{
{
	struct xfs_log_vec	*log_vector;
	struct xfs_log_vec	*log_vector;
	int			error;


	/*
	/*
	 * Get each log item to allocate a vector structure for
	 * Get each log item to allocate a vector structure for
@@ -1766,9 +1765,7 @@ xfs_trans_commit_cil(
	if (!log_vector)
	if (!log_vector)
		return ENOMEM;
		return ENOMEM;


	error = xfs_log_commit_cil(mp, tp, log_vector, commit_lsn, flags);
	xfs_log_commit_cil(mp, tp, log_vector, commit_lsn, flags);
	if (error)
		return error;


	current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS);
	current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS);
	xfs_trans_free(tp);
	xfs_trans_free(tp);