The following quote I found enlightening. It's part of a much bigger discussion of coming to Christ, so that is what he refers to by saying that all are welcome.
"All of you are welcome, whatever circumstances you find yourself in here in mortality. Your circumstances are His gift to you, because they are uniquely fitted to refine you so you can return to Him. Don't reject them as distractions, but use them to propel yourself upward. Gravity is at first the enemy of the infant, but soon becomes the play-thing by which all children learn to run. The faster they recover from the forward fall, the faster they run. Learn from your life's specific gravity to run back to Him. Be grateful for your lot in life. It was carefully given to you for your blessing and development." (The Second Comforter)
Related to this is something I learned from the book of Hebrews (click on the link, Heb. 12: 5-6, 11-12). "Whom the Lord loves, he chastens." Sometimes when such things happen, when life brings hardship or great difficulty or God see's fit for something we wonder if God really loves us. Maybe he doesn't really care we may wonder to ourselves. The opposite is actually true. When God chastens it's actually a sign that he does love, it's a sign of many good things. According to Hebrews vs 6 it's a sign that your part of the family, a son. Verse 11 says "Now no chastening for the present seemeth to be joyous, but grievous: nevertheless afterward it yieldeth the peaceable fruit of righteousness unto them which are exercised thereby." So although the Lord's dealings can be very challenging, it's temporary, and it results in peace, the peaceable fruits of righteousness. I believe that's the true perspective to keep.
It could be said there are 3 main types of chastening from the Lord. Following God brings plenty of all three, which again, is a very good thing.
Corrective. When the Lord corrects you, shows you an error, or problem that needs to be addressed. Maybe he starts reworking your foundation, your internal life, it can be searing to the soul. This is truly a blessing when considering the outcome it has. With that view it's hard to question the Lords love in what he does.
Preventative. When God orchestrates events and situations of your life that in fact are designed to prevent a catastrophe later on. There are coming collisions, there is a day of judgment, there are critical things going on in eternity. If life deals us a situation we don't like, circumstances are far less than ideal... it may be wise to ponder in your heart how the Lord often does preventative work with us. Sometimes our circumstances in fact prevent far worse things from happening down the road. This is very loving.
Teaching. The third main type of chastening could be categorized as teaching. The Lord teaches us by our experiences (D&C 122: 7). One of the main purposes of life was to learn by our own experience to distinguish the good from the bad. The Lord teaches us by what we pass through (Rom. 5: 3-4). Some experiences help us have compassion for others, some experiences help us understand eternal truths, others work patience and wisdom. How important are wisdom and patience? I think consequences are a great teacher, it's how the universe works. We certainly can't blame God for not being loving when we make a series of poor choices and then don't like the consequences. Thankfully God is patient.
The Lord indeed loves as a perfect Father. There is no mistake in what He lovingly does, and no mistaking that it is loving. Verse 12 from the above Hebrews scripture: "Wherefore lift up the hands which hang down, and the feeble knees" What once were hands hung in defeat, are hands lifted in praise and worship, able to give. Feeble knees become firm knees, kneeling before He who is Holiness.