• Sukadev Bhattiprolu's avatar
    ibmvnic: serialize access to work queue on remove · 4a41c421
    Sukadev Bhattiprolu authored
    The work queue is used to queue reset requests like CHANGE-PARAM or
    FAILOVER resets for the worker thread. When the adapter is being removed
    the adapter state is set to VNIC_REMOVING and the work queue is flushed
    so no new work is added. However the check for adapter being removed is
    racy in that the adapter can go into REMOVING state just after we check
    and we might end up adding work just as it is being flushed (or after).
    
    The ->rwi_lock is already being used to serialize queue/dequeue work.
    Extend its usage ensure there is no race when scheduling/flushing work.
    
    Fixes: 6954a9e4 ("ibmvnic: Flush existing work items before device removal")
    Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.ibm.com>
    Cc:Uwe Kleine-König <uwe@kleine-koenig.org>
    Cc:Saeed Mahameed <saeed@kernel.org>
    Reviewed-by: default avatarDany Madden <drt@linux.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4a41c421
ibmvnic.h 25.1 KB