In an action to foreclose a mortgage upon such real property only such persons who shall have filed notices of lien prior to the filing of the notice of lis pendens in such action shall be deemed to be necessary parties to such action.
N.Y. Lien Law § 44-A