A method of distributing oil to a component within a gas turbine engine includes directing a first oil flow from an oil source to an engine component and back to the oil source, directing a second oil flow from the oil source to a generator driven by the engine and back to the oil source, monitoring a parameter of the second oil flow downstream of the generator and upstream of the oil source, detecting a contaminant in the second oil flow based on the parameter, and reducing the second oil flow to the generator when the contaminant is detected without reducing the first oil flow to the engine component. A shared oil system for a component of a gas turbine engine and a generator driven by the gas turbine engine is also discussed.