HomeFreeBSD

zfs: use atomic_load_64 to read atomic variable in dmu_object_alloc_impl

Description

zfs: use atomic_load_64 to read atomic variable in dmu_object_alloc_impl

As long as we support ZFS on 32-bit platforms we should do this for all
64-bit variables that are modified in a lockless fashion using atomic
operations. Otherwise, there is a risk of a reading a torn value.

Here is a rationale for why I am doing this in dmu_object_alloc_impl:

  • it's very recent code
  • the code deals with object IDs and a number of objects in a file system can overflow 32 bits
  • incorrect allocation of an object ID may result in hard to debug problems
  • fixing all plain reads of 64-bit atomic variables is not a trivial undertaking to do in one shot, so I chose to do it incrementally

MFC after: 3 weeks
X-MFC after: r353301, r353176

Details

Provenance
avgAuthored on
Parents
rS353303: Validate length before use it, not vice versa.
Branches
Unknown
Tags
Unknown