Skip to content
  • Dan Williams's avatar
    libnvdimm/namespace: Fix label tracking error · c4703ce1
    Dan Williams authored
    Users have reported intermittent occurrences of DIMM initialization
    failures due to duplicate allocations of address capacity detected in
    the labels, or errors of the form below, both have the same root cause.
    
        nd namespace1.4: failed to track label: 0
        WARNING: CPU: 17 PID: 1381 at drivers/nvdimm/label.c:863
    
        RIP: 0010:__pmem_label_update+0x56c/0x590 [libnvdimm]
        Call Trace:
         ? nd_pmem_namespace_label_update+0xd6/0x160 [libnvdimm]
         nd_pmem_namespace_label_update+0xd6/0x160 [libnvdimm]
         uuid_store+0x17e/0x190 [libnvdimm]
         kernfs_fop_write+0xf0/0x1a0
         vfs_write+0xb7/0x1b0
         ksys_write+0x57/0xd0
         do_syscall_64+0x60/0x210
    
    Unfortunately those reports were typically with a busy parallel
    namespace creation / destruction loop making it difficult to see the
    components of the bug. However, Jane provided a simple reproducer using
    the work-in-progress sub-section implementation.
    
    When ndctl is reconfiguring a namespace it may take an existing defunct
    / disabled namespace and reconfigure it with a new uuid and other
    parameters. Critically namespace_update_uuid() takes existing address
    resources and renames them for the new namespace to use / reconfigure as
    it sees fit. The bug is that this rename only happens in the resource
    tracking tree. Existing labels with the old uuid are not reaped leading
    to a scenario where multiple active labels reference the same span of
    address range.
    
    Teach namespace_update_uuid() to flag any references to the old uuid for
    reaping at the next label update attempt.
    
    Cc: <stable@vger.kernel.org>
    Fixes: bf9bccc1 ("libnvdimm: pmem label sets and namespace instantiation")
    Link: https://github.com/pmem/ndctl/issues/91
    
    
    Reported-by: default avatarJane Chu <jane.chu@oracle.com>
    Reported-by: default avatarJeff Moyer <jmoyer@redhat.com>
    Reported-by: default avatarErwin Tsaur <erwin.tsaur@oracle.com>
    Cc: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    c4703ce1