Skip to contentSkip to conversation

xfs: add a check for xfs_trans_commit

PATCH In review Kangjie Lu 2 participants 2 messages Dec 26, 2018 – Dec 27, 2018 XFS filesystem

lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 xfs: add a check for xfs_trans_commit

xfs_trans_commit could fails. The checks issues an error message upon its failure.

---
 fs/xfs/xfs_super.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/xfs/xfs_super.c +5 -1
index d3e6cd063688..8ec2e3c8e946 100644
@@ -1010,6 +1010,7 @@ xfs_fs_dirty_inode(
 	struct xfs_inode		*ip = XFS_I(inode);
 	struct xfs_mount		*mp = ip->i_mount;
 	struct xfs_trans		*tp;
+	int error;
 
 	if (!(inode->i_sb->s_flags & SB_LAZYTIME))
 		return;
@@ -1021,7 +1022,10 @@ xfs_fs_dirty_inode(
 	xfs_ilock(ip, XFS_ILOCK_EXCL);
 	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
 	xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP);
-	xfs_trans_commit(tp);
+	error = xfs_trans_commit(tp);
+	if (error)
+		xfs_err(mp,
+				"Error in xfs_trans_commit: %d\n", error);
 }
 
 /*
Signature · 1 line
2.17.2 (Apple Git-113)
#1 lore raw
Quoted 4 lines · Kangjie Lu

xfs_trans_commit could fails. The checks issues an error message upon its failure.

Please take a close look at what could fail in xfs_trans_commit, and how those failures are logged inside the implementation.