When there are liens on the interest of any party in the subject so sold, the court may, on the petition of any person holding a lien, ascertain the liens, and apply the dividend of such party in the proceeds of sale to the discharge thereof, so far as the same may be necessary.
Va. Code § 8.01-84