Will I lose my house if I file bankruptcy?
Is there equity in the property?
If there is no equity in the house (today's value less costs of sale less payoff balances on all liens) the trustee in a Chapter 7 will abandon the house to you. That is, you keep it, as long as you pay the mortgages.
A bankruptcy does not relieve the property of the liability for voluntary liens, like mortgages or deeds of trust, nor for tax liens. So, the lender retains the right to foreclose if you don't pay.
If you pay, everyone is happy. Remember, the lender doesn't want the property; it wants you to pay regularly on the loan. Foreclosure is a last resort for the lender if it concludes it can't get its money any other way.
If there is equity
Determine whether the exemptions available to you equal or exceed the equity in the property. If the equity is all exempt, you can keep the house, so long as you pay the mortgages.
If the exemption is not sufficient to protect the equity, consider Chapter 13.
Also ask yourself, should you keep the house?
Issues in California foreclosures
Can you strip involuntary liens from the property?
Can you strip voluntary liens?