The filing of the bankruptcy will stop if foreclosure, depending on the type of bankruptcy that is filed. A Chapter 7 bankruptcy may only temporarily stop a foreclosure. Whereas a Chapter 13 will put an indefinite hold on a foreclosure as long as there is an attempt to make mortgage payments and cure the mortgage or rearrange in some way during the Chapter 13. There is also the possibility of modifying the mortgage as part of the Chapter 13 filing that can be done in the bankruptcy.
This is a subject that is covered in the book that I’ve just written and just had published called Bankruptcy,Get The Fresh Start That You Deserve.