Run your wide drywall knife along the whole stain area, taking off any flaking, bumps or other obstructions. If any of the sheetrock is crumbling or loose, run the edge of the knife along it at a 90-degree angle to scrape it off.
Apply a thick but smooth layer of sealing primer over the whole area, using your paint roller. Work the primer well around the stain.
Let the primer dry overnight. If any sign of the stain is still showing through the paint, apply a second coat in the same manner as the first. Let it dry. Repeat until the stain is completely sealed.
Use your drywall knife to spread a very thin layer of joint compound over any indented area around the stain where you scraped off damaged surface material. Get it completely flat and smooth. Let it dry completely.
Lightly sand the joint compound with your drywall sander.
Repaint the entire ceiling.