For PSLF, you have to make 120 on-time payments under one of the approved repayment plans (standard, graduated, IBR, PAYE, or ICR). Periods of deferment or forbearance do not count. So if you start paying your loans in 2010 and in 2012 you do two years of deferment for a master’s degree, your loans won’t be fully forgiven until 2022.
I know some people who have done forbearance. It’s not that bad - it’s sort of akin to deferment. It doesn’t necessarily mean you totally stop paying; you can request a reduction in your monthly payment from your loan servicer for a period of time, or you can request no payments. (Any months you spend in forbearance obviously don’t count towards the 10 years of PSLF or the 20 years of regular forgiveness.) But you only get 12 months of forbearance and interest continues to accrue on the unpaid debt.
I hang around some graduate forums, and my experiences in there has made me a really strong proponent of limits on how much can be forgiven under federal lending programs. I’ve been in forums where people have discussed wanting to attend very expensive master’s programs in social work or education, and others have encouraged them to just borrow as many federal loans as they want, knowing that they can get the public service loan forgiveness. There’s basically no incentive for, say, a prospective MSW student to choose his or her inexpensive local public regional over a fancy private university that really offers no additional value in that particular field.