The plaintiff shall make creditors having liens upon the property or any portion thereof, defendants in the action. When the lien is upon an undivided interest or estate of any of the parties, if a partition is made, such lien is thenceforth a lien only upon the share assigned to such party, but such share shall be first charged with its just proportion of the costs of the partition, in preference to such lien.