[PATCH 5/5] xfs: handle CIl transaction commit failures correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dave Chinner <dchinner@xxxxxxxxxx>

Failure to commit a transaction into the CIL is not handled
correctly. This currently can only happen when racing with a
shutdown, so it rare. Handle the error similar to a log vector
memory allocation failure, and for both failures clear the PF_TRANS
flag from the task correctly.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 fs/xfs/xfs_trans.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 50753d3..504a804 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -1754,15 +1754,26 @@ xfs_trans_commit_cil(
 	 */
 	log_vector = xfs_trans_alloc_log_vecs(tp);
 	if (!log_vector)
-		return ENOMEM;
+		goto out_enomem;
 
 	error = xfs_log_commit_cil(mp, tp, log_vector, commit_lsn, flags);
-	if (error)
-		return error;
+	if (error) {
+		/*
+		 * We will only get an error if no modifications have been
+		 * made to the items in the transaction. Hence treat it
+		  the same as a memory allocation failure.
+		 */
+		goto out_enomem;
+	}
 
 	current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS);
 	xfs_trans_free(tp);
 	return 0;
+
+out_enomem:
+	/* caller cleans up transaction */
+	current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS);
+	return ENOMEM;
 }
 
 /*
-- 
1.7.2.3

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux