Issue with write operations while rolling updates

Hi!
We’re running a MongoDB cluster with 1 primary and 2 secondary nodes (mainly used for reads). In our connection string, we currently use w=3, since our clients require that data is immediately available for reads after a save.
This works well under normal conditions. However, during maintenance or rolling updates, only two mongo nodes may be available. In that case, the write operation fails because all 3 nodes cannot acknowledge it.
How can we fix this?
We’d like to ensure that a write is acknowledged by all currently available nodes - normally 3, but only 2 during a rolling update.

Regards,
Łukasz