A method, apparatus and program storage device for protecting data write
operations against write failures in a data storage device is provided.
The data storage device includes a storage medium, a write cache
including a copy of data written to the storage medium, and a controller
configured for testing data write operations to the storage medium. The
controller tests data write operations to the storage medium before the
write cache is flushed to confirm that it is safe to flush the write
cache. If the test fails, the data in the write cache can be recovered.