You are correct in thinking that oxygen comes from photosynthesis. In fact it is so much associated with photosynthesis, as opposed to any inorganic process, that the presence of oxygen in the atmospheric spectrum of other planets (solar or exoplanets) is reckoned to be one of the best indicators of life beyond Earth - not that such oxygen has been discovered yet.
Ozone is made from pre-existing oxygen but with an atmospheric half life of only about 12 minutes, it spontaneously turns back into oxygen again very rapidly, and is highly sensitive to ozone-disrupting agents such as CFCs.
Meteorites have little, if any free oxygen. Indeed, many meteorites contain Ni-Fe which would rapidly mop up any free oxygen if it were originally present. Volcanic activity reflects the fugitive gasses of a magma chamber, which contains F, Cl, CO2, CO, H2O, H2S, N2, inert gasses, and hydrogen. Oxygen can occur in in a few volcanic emanations but this is rare and of small scale. On balance, volcanoes are oxygen absorbers rather than emitters. Photo-dissociation occurs to some extent high in our atmosphere in response to both solar and cosmic radiation. The result is H2O = H+ +OH- so there is no free oxygen involved. In any case, the two ions recombine fairly rapidly. Photo-dissociation is important in dense interstellar gas clouds far out in space where they may be subject to intense UV-radiation. Even here, the tendency is to mop up rather than release free oxygen.
The photosynthetic activity and mechanism on Earth has changed dramatically. It is the only known mechanism which can and does release large quantities of free oxygen. This started more than 3 billion years ago, but didn't raise the atmospheric oxygen level significantly prior to about 2.5 billion years ago. Evolution of the Earth's oxygen has been a long and complex affair, with high levels of oxygen only starting to emerge in the Eocambrian. The Earth's first oxygen would have been a noxious, toxic, and horribly reactive gas from the perspective of the Earth's earliest unicellular organisms.
New information just in: Nature magazine, 28th October 2015, has reported an astonishingly high oxygen concentration, of 3.8%, from the gaseous emissions from comet 67P, as measured by the Rosetta space probe. This has taken everyone by surprise (including myself) and may require a re-think about comet formation.