Bankruptcy may avoid foreclosure under a Chapter 13 repayment plan of arrearages or by stripping of a second mortgage entirrely (where the value of the home is less than the first mortgage, leaving the second note holder "unsecurred"). The second is not stripped until the completion of the plan, at which time the lien is stripped and the debt is discharged.
A bankruptcy may also buy more time to complete a loan modification. In some cases, the bank loan mod department and their legal department fail to coordinate, and homeowners are being foreclosed upon smack in the middle of their loan modification negoatiations. Attorneys here in Sacramento (California Eastern District Bankruptcy court) are requred to assist homeowners with their loan modifications if representing a Chapter 13 debtor ("reaffirmation agreement negotiations" in Bankruptcy Law terminology). If you have run out of time (a Notice of Sale is pending), don't assume the bank will hold off on the sale simply because you are negotiating a loan modification. Get your automatic stay as Cooper Group discusses.