They tell me that BMW is the only motorcycle manufacturer that puts an internal coating on their gas tanks. From the number of rusted tanks I've seen, this must be true. If you have rusted tank, you are between a rock and a hard spot. The best fix is a new tank. This is not always practical because rusted tanks are usually found on old bikes. A new tank can cost $400 to $500 dollars if you can find one. Most old bikes aren't worth it. Sooo... what to do ?
There are several kinds of tank coatings offered for sale. I've only used one, the most common major brand, and I was not impressed. The tank I used it on was in like new condition with a small crack in the bottom that seeped gas. The tank had no rust in it. I cleaned, acid washed, and coated the tank, per factory instructions. I let it dry for two days with a very low pressure air hose circulating air to the tank. I put gas in and guess what ? It leaked right at the crack. I then soldered the crack and that fixed it. I figure that if it will not seal a good clean tank what chance will a rusty one have. Others may have had better luck, but I don't like paying $30-$35 for nothing. It is also true that I have not tried all the coatings on the market. The choice is up to you. One thing else to consider... I've seen a number of tanks where the coatings have come loose and it ends up quite the mess.
So what to do ? If rust is the only problem here is what I do. I put some large nuts (off bolts, not the eating kind !) in the tank and shake it vigorously for a while. Then wash out as much rust as you can with gas. Now put the tank back on and put a see through fuel filter in the gas line to the carb. This will keep any rust or dirt from getting into the carb. When the filter fills up with rust, change it for a new one. This is the cheapest way to go.
If you have a small rust pinhole you may have a really bad problem. The tank may look good, but the inside is all rusted out. The only real cure is a new or different tank.
If the leak is caused by a crack or puncture you can repair it by soldering or welding the tank. The only problem is gas tanks tend to blow up when a flame is applied to them. Not good ! The cure is pretty easy, but might be hard to do for the average person. You will have to have a tank of some kind of inert gas that will not burn. Simply fill the gas tank with inert, non-flammable, gas under slight pressure and weld away. No oxygen, no blown up tanks or so the theory goes. Just make sure the tank is purged of any air ! I'm always surprised at how many good welders don't know this. They try to fill the tank with water, flame off any gas, and BOOM they still blow up. Right idea, wrong filler. For the average guy it might just be best to take it to a good welder who knows the trick. You can get a two part epoxy made especially for gas tank repair. I've used it a couple of times and the fix held. Just remember that these epoxies work good for a limited time. Sooner or later they will fail. Sometimes they seem to last forever... other times the same glue doesn't last at all. On an old bike or in an emergency they do seem to work well.
If you have to get a newer, unrusted tank, try a salvage yard. Take your old tank with you. You may be able find a tank off another make or model that will fit with a little bit of modification.
Now about fuel petcocks. The standard petcock has ON-OFF-RES (RESERVE). OFF is, well, off. ON takes fuel from a tube that sticks up from the petcock body into the tank. When the fuel level goes below the top of the tube, the carb runs out of gas until you turn on the reserve. The RES draws fuel from the bottom of the tank. Both tubes usually have fine wire filter screens on them and another screen in the petcock it's self.
The second type of petcock has a diaphragm that automatically shuts off the gas when the engine stops. You will see a hose going from the petcock to a fitting on the intake manifold of one of the carbs. This supplies vacuum to one side of the diaphragm, opening the fuel valve inside the petcock. These petcocks have three settings. ON-RESERVE-PRI. ON is on. Reserve is reserve and PRI is Prime. Prime bypasses the diaphragm so you can fill the carbs with gas after they have been drained. Set it on PRI, fill the carbs and put it back to ON. Sometimes, ON is called MAIN.
The third type is just an ON-OFF valve. These are used mostly on racing machines which have no need of a reserve. Most fuel petcocks are fairly expensive to replace, considering what they are. Some can be taken apart and fixed. Others can be taken apart, but you can't get parts for them, and some are riveted together. The riveted ones seem to be on newer bikes and can only be replaced.
If there is fuel flowing but the valve won't turn it off, the fix is easy. Just get a plastic inline valve from a lawn mower dealer and put it in the fuel line going to the carb.
If the factory doesn't have any replacement parts (like the diaphragm) you can, sometimes, get after market parts. I haven't used any because by the time the petcock gets this bad the bike is so old no one wants to send the money on it.
There has to be some way for air to enter the tank as the fuel flows into the carb(s). If the vent becomes plugged the gas will not flow. Most times there is a small vent hole in the gas cap. Now that the EPA is looking at bikes, those caps may have one way valves in them or be sealed completely and the tank have a vent tube. Some of the Harley Davidson tanks have two caps and one will be non-vented.
Older Japanese bikes and bikes with two piece gas tanks will have a crossover tube. These are a real pain because you must drain all the gas before you can take the tank off. The newer tanks are much better. A lot of dirt bikes now have plastic tanks, which are real neat until one gets a hole or crack. They do have some plastic glues out but I would not trust them on a gas tank. It is a good idea to keep the plastic tanks (and any plastic) out of the sun as much as possible.