• Guoqing Jiang's avatar
    md: add new workqueue for delete rdev · cc1ffe61
    Guoqing Jiang authored
    Since the purpose of call flush_workqueue in new_dev_store is to ensure
    md_delayed_delete() has completed, so we should check rdev->del_work is
    pending or not.
    
    To suppress lockdep warning, we have to check mddev->del_work while
    md_delayed_delete is attached to rdev->del_work, so it is not aligned
    to the purpose of flush workquee. So a new workqueue is needed to avoid
    the awkward situation, and introduce a new func flush_rdev_wq to flush
    the new workqueue after check if there was pending work.
    
    Also like new_dev_store, ADD_NEW_DISK ioctl has the same purpose to flush
    workqueue while it holds bdev->bd_mutex, so make the same change applies
    to the ioctl to avoid similar lock issue.
    
    And md_delayed_delete actually wants to delete rdev, so rename the function
    to rdev_delayed_delete.
    Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
    Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
    cc1ffe61
md.c 256 KB