diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 62442e413a001cfbe57607c43e06d408418cf13e..a49fa44aea1f33c982bcd3dd7203ed702fb66652 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1918,8 +1918,10 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
 
 	mutex_unlock(&inode->i_mutex);
 
+	if (written)
+		ret = written;
 	mlog_exit(ret);
-	return written ? written : ret;
+	return ret;
 }
 
 static int ocfs2_splice_to_file(struct pipe_inode_info *pipe,