This is a complex question. In general a bankruptcy will only effect the mortgages if you try to change them some way in the bankruptcy proceeding. This all depends on the chapter you filed, if you are behind on payments, how much the mortgage company wants to work with you, your income / expenses, etc.
Speak with an attorney about your specific situation. If you can not find an attorney, contact your local Bar association and they will refer you to one.