Godly sorrow brings repentance that leads to salvation and leaves no regret, but worldly sorrow brings death.-2 Corinthians 7:10
Paul has been writing to the Corinthians about a previous letter he had sent them that grieved them. It was a corrective letter, and when the Corinthians read it they were sad for the things they had been doing wrong (v8-9). Paul says that he doesn't regret sending the letter even though it grieved them, because of verse ten (although he says he did not enjoy it).
The benefits of the Corinthians' sorrow are outlined in verse 11:
See what this Godly sorrow has produced in you: what earnestness, what eagerness to clear yourselves, what indignation, what alarm, what longing, what concern, what readiness to see justice done.
Godly sorrow is healthy; in this context, the sorrow is sorrow from correction, so I won't overextend this into sorrow in other kinds of sorrow. Accepting correction humbly is a sign of wisdom found other places in the Bible as well (Proverbs 12:1 and 13:18 for starters).
If you're facing correction, don't waste time with shame (Romans 8:1-2). We learn some of our best lessons from our mistakes. While we shouldn't go out to make mistakes just to learn from them (that would be taking advantage of grace), we also can't change the past. We can learn from it, but that's one of the few useful things we can do with it. This Godly sorrow that comes from correction will grow a deeper maturity when we let it.
If you seem to learn the same lesson over and over again and are frustrated that your flesh drags you back to the same thing again and again (for me, a repeated one has been wasting large amounts of time on video games), just remember that Romans 8:1-2 is always true, no matter how many times in a row you have fallen, no matter if it was just in the last ten minutes, or if you relapsed after ten months of freedom from this sin...
Therefore, there is now no condemnation for those who are in Christ Jesus, because through Christ Jesus the law of the Spirit of life set me free from the law of sin and death.