CA-141611: support for write I/O barriers

... But you restore `0` to `err` later, so if there was a non-zero error, it might get overridden.