Skip to content
  • Dan Williams's avatar
    mm, devm_memremap_pages: fix shutdown handling · a95c90f1
    Dan Williams authored
    The last step before devm_memremap_pages() returns success is to allocate
    a release action, devm_memremap_pages_release(), to tear the entire setup
    down.  However, the result from devm_add_action() is not checked.
    
    Checking the error from devm_add_action() is not enough.  The api
    currently relies on the fact that the percpu_ref it is using is killed by
    the time the devm_memremap_pages_release() is run.  Rather than continue
    this awkward situation, offload the responsibility of killing the
    percpu_ref to devm_memremap_pages_release() directly.  This allows
    devm_memremap_pages() to do the right thing relative to init failures and
    shutdown.
    
    Without this change we could fail to register the teardown of
    devm_memremap_pages().  The likelihood of hitting this failure is tiny as
    small memory allocations almost always succeed.  However, the impact of
    the failure is large given any future reconfiguration, or disable/enable,
    of an nvdimm namespace will fail forever as s...
    a95c90f1