Did a gas mask work as well in preventing a soldier from succumbing to poison gas as well as it was intended?
Up to a point they were yes. They required constant adaptation though as one type of filter was generally effective against one type of gas.
For example the first gas attacks were using dichlore (nicknamed "Bertholite") a type of chlorine gas which were very soon countered by soldiers by pissing on some fabric and putting it over their face, the ammonia of the urine reacted and greatly diminished the toxicity of the gas, so the Germans started using another gas, that the allies tried to counter etc...
So yeah they were effective until the enemy found some other gas you were not prepared for. Then you would put your gasmask only to realize it was not efficient against this new gas.
Some gases also attacked the skin of the soldier, causing chemical burns and blinding them. Obviously gas masks protected soldiers from the respiratory effects but the burns could have been countered only by a proper NBC suit which were not around at the time.
Another thing with gasmasks of the time few people think about is that you just can't see shit and it is close to impossible to aim a weapon while wearing it meaning you would have either to take it off to fight or keep it and not be really efficient at killing the enemy.