On Mon, 2020-08-17 at 17:28 +0200, Peter Krempa wrote:
On Mon, Aug 17, 2020 at 16:26:55 +0200, Michal Privoznik wrote:
> - if ((controlFD = virDMOpen()) < 0)
> + if ((controlFD = virDMOpen()) < 0) {
> + if (controlFD == -2) {
> + /* Devmapper was available but now it isn't. Somebody
> + * must have removed the module. Reset the major
> + * number we remember. */
> + virDMMajor = 0;
This overwrites 'virDMMajor' without taking the mutex. 'unsigned int' on
x86_64 will be atomic, we shouldn't use a knowingly broken code pattern
without at least a proper explanation why it's okay.
IIUC you're saying that you'd be okay with adding a comment that
explains why this will work fine on x86_64. If so, I'd like to point
out that libvirt supports many other architectures... Is the same
pattern safe on those as well?
--
Andrea Bolognani / Red Hat / Virtualization