From: NeilBrown <neilb@suse.com>
To: Shaohua Li <shli@kernel.org>
Cc: Linux Raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH] md: create new workqueue for object destruction
Date: Wed, 18 Oct 2017 18:29:08 +1100 [thread overview]
Message-ID: <87h8uwj4mz.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20171018062137.ssdhwkeoy6fdp7yq@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1777 bytes --]
On Tue, Oct 17 2017, Shaohua Li wrote:
> On Tue, Oct 17, 2017 at 04:04:52PM +1100, Neil Brown wrote:
>>
>> lockdep currently complains about a potential deadlock
>> with sysfs access taking reconfig_mutex, and that
>> waiting for a work queue to complete.
>>
>> The cause is inappropriate overloading of work-items
>> on work-queues.
>>
>> We currently have two work-queues: md_wq and md_misc_wq.
>> They service 5 different tasks:
>>
>> mddev->flush_work md_wq
>> mddev->event_work (for dm-raid) md_misc_wq
>> mddev->del_work (mddev_delayed_delete) md_misc_wq
>> mddev->del_work (md_start_sync) md_misc_wq
>> rdev->del_work md_misc_wq
>>
>> We need to call flush_workqueue() for md_start_sync and ->event_work
>> while holding reconfig_mutex, but mustn't hold it when
>> flushing mddev_delayed_delete or rdev->del_work.
>>
>> md_wq is a bit special as it has WQ_MEM_RECLAIM so it is
>> best to leave that alone.
>>
>> So create a new workqueue, md_del_wq, and a new work_struct,
>> mddev->sync_work, so we can keep two classes of work separate.
>>
>> md_del_wq and ->del_work are used only for destroying rdev
>> and mddev.
>> md_misc_wq is used for event_work and sync_work.
>>
>> Also document the purpose of each flush_workqueue() call.
>>
>> This removes the lockdep warning.
>
> I had the exactly same patch queued internally,
Cool :-)
> but the mdadm test suite still
> shows lockdep warnning. I haven't time to check further.
>
The only other lockdep I've seen later was some ext4 thing, though I
haven't tried the full test suite. I might have a look tomorrow.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-10-18 7:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 5:04 [PATCH] md: create new workqueue for object destruction NeilBrown
2017-10-18 6:21 ` Shaohua Li
2017-10-18 7:29 ` NeilBrown [this message]
2017-10-18 11:21 ` Artur Paszkiewicz
2017-10-18 22:36 ` NeilBrown
2017-10-19 8:27 ` Artur Paszkiewicz
2017-10-19 22:28 ` NeilBrown
2017-10-20 14:00 ` Artur Paszkiewicz
2017-10-22 23:31 ` NeilBrown
2017-10-27 10:44 ` Artur Paszkiewicz
2017-10-29 22:18 ` NeilBrown
2017-10-30 13:02 ` Artur Paszkiewicz
2017-11-01 3:57 ` NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h8uwj4mz.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=linux-raid@vger.kernel.org \
--cc=shli@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).