Basic form without idafah:
فِي مَسَاجِدَ — genitive with fathah.
Important exception in idafah:
فِي مَسَاجِدِ اللهِ — مَسَاجِدِ is the mudaf and takes kasrah.
Why? When the ghayr munsarif noun becomes mudaf, the genitive ending is kasrah. Therefore “a ghayr munsarif noun always has fathah in the genitive” is too broad.