OSDN Git Service

md: add new workqueue for delete rdev
authorGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Sat, 4 Apr 2020 21:57:08 +0000 (23:57 +0200)
committerSong Liu <songliubraving@fb.com>
Wed, 13 May 2020 18:22:31 +0000 (11:22 -0700)
commitcc1ffe61c026e2318024bfa8722e8f689fd2a7f4
treee6df0755b0de837a1146ac77758a0a47ddc97258
parent21e0958ec9684e76e32f822c5e611a7d7ea0a5ba
md: add new workqueue for delete rdev

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: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
drivers/md/md.c