First fix the water problen so that will not occur.
There are many primers/sealer for that. I like Kilz. Use 2, or better yet 3 coats of Kilz. Be sure to go 6" beyond the stain as over time the stain may bleed beyond the original borders.
After that paint with your regular top coat.
© 2017 Renovate Your World LLC