1. 27 1月, 2020 33 次提交
  2. 25 1月, 2020 6 次提交
  3. 24 1月, 2020 1 次提交
    • M
      qemu_capabilities: Rework domain caps cache · c7600931
      Michal Privoznik 提交于
      Since v5.6.0-48-g270583ed we try to cache domain capabilities,
      i.e. store filled virDomainCaps in a hash table in virQEMUCaps
      for future use. However, there's a race condition in the way it's
      implemented. We use virQEMUCapsGetDomainCapsCache() to obtain the
      pointer to the hash table, then we search the hash table for
      cached data and if none is found the domcaps is constructed and
      put into the table. Problem is that this is all done without any
      locking, so if there are two threads trying to do the same, one
      will succeed and the other will fail inserting the data into the
      table.
      
      Also, the API looks a bit fishy - obtaining pointer to the hash
      table is dangerous.
      
      The solution is to use a mutex that guards the whole operation
      with the hash table. Then, the API can be changes to return
      virDomainCapsPtr directly.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1791790Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
      c7600931