Fix deadlock on waiting for pending_writers to be empty

Deadlock can occur when a reader X waits for pending writers
to be empty but the reader X already owns a read lock (since
it will then wait for pending writers to be empty which it
will never be, since pending writers is only empty when
there are no readers - but since the current thread X is getting
another read lock it result in deadlock for the reader and
deadlock for the writer).

Closes-Bug: #1276868

Change-Id: Ibe13eafa4bd0bc817e8bfe3cf303c54298778b37
Add validate() base method

Now that all backends implement a validate that
can be called to check if the backend is still
useable we can add a base method to the base class
that defines exactly what this new method does.

Change-Id: Ica4571970bad2de16ce2071a645abf24c25c110b
Merge "Fix deadlock on waiting for pending_writers to be empty"