1. 23 8月, 2019 1 次提交
    • M
      storage_driver: Protect pool def during startup and build · 13284a6b
      Michal Privoznik 提交于
      In near future the storage pool object lock will be released
      during startPool and buildPool callback (in some backends). But
      this means that another thread may acquire the pool object lock
      and change its definition rendering the former thread access not
      only stale definition but also access freed memory
      (virStoragePoolObjAssignDef() will free old def when setting a
      new one).
      
      One way out of this would be to have the pool appear as active
      because our code deals with obj->def and obj->newdef just fine.
      But we can't declare a pool as active if it's not started or
      still building up. Therefore, have a boolean flag that is very
      similar and forces virStoragePoolObjAssignDef() to store new
      definition in obj->newdef even for an inactive pool. In turn, we
      have to move the definition to correct place when unsetting the
      flag. But that's as easy as calling
      virStoragePoolUpdateInactive().
      
      Technically speaking, change made to
      storageDriverAutostartCallback() is not needed because until
      storage driver is initialized no storage API can run therefore
      there can't be anyone wanting to change the pool's definition.
      But I'm doing the change there for consistency anyways.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      13284a6b
  2. 22 8月, 2019 32 次提交
  3. 21 8月, 2019 7 次提交