In Master and Margarita, Ivan and the Master are both writers who meet in an insane asylum.
Ivan's fate comes from his chasing the Devil, who murdered Berlioz, a famous editor. He is not convinced that the man is actually the Devil, but chases him instead to apprehend a murderer, and because of his certainty he becomes lost, chased himself, and ends up in Berlioz's literary society. His words and actions seem insane and he is committed:
"Over-excitation of motor and speech functions... delirious interpretations... looks like a complex case... Schizophrenia, I would assume. And the alcoholism to boot..."
(Bulgakov, Master and Margarita, Google Books)
Ivan's diagnosis is done by an exhausted doctor who simply wants him taken away, and so his view of reality and honest behavior is shaken. Eventually, his experiences lead him to renounce poetry and become a historian.
The Master is a writer whose magnum opus has driven him to insanity. His work concerns Pontius Pilate, the magistrate who sentenced Jesus to death, and even though it was rejected by publishers the newspaper reviewers still insulted and belittled it in print. Furious, the Master burned his manuscript and gave all his money to his lover, Margarita; he is committed to the same asylum and finds himself able to escape but with no motivation. Eventually, he is able to reconcile his life's work with his own life, and is allowed to rest in eternal Limbo with Margarita.