From: NeilBrown <neilb@suse.com>
To: Shaohua Li <shli@kernel.org>
Cc: linux-raid@vger.kernel.org
Subject: Re: [md PATCH 1/5 v2] md: always hold reconfig_mutex when calling mddev_suspend()
Date: Mon, 23 Oct 2017 11:02:23 +1100 [thread overview]
Message-ID: <87sheaenow.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20171020042820.iredht4f7lvatdst@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2247 bytes --]
On Thu, Oct 19 2017, Shaohua Li wrote:
>> >
>> > For this one, my point is:
>> >
>> > wait_event(mddev->sb_wait, conf->log == NULL ||
>> > !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags));
>> > if (conf->log == NULL)
>> > return;
>> >
>> > mddev_suspend(mddev);
>> > log->r5c_journal_mode = R5C_JOURNAL_MODE_WRITE_THROUGH;
>> > mddev_resume(mddev);
>> >
>> > does it work?
>>
>> The
>> lockdep_assert_held(&mddev->reconfig_mutex);
>> in mddev_suspend() will complain.
>>
>> If you put an mddev_lock() call in there to stop the complaint, and if
>> the work item doesn't start before the reconfig_mutex is taken prior to
>> stopping the array, then r5l_exit_log() can deadlock at
>> flush_work(&log->disable_writeback_work);
>
> Ok, got it now. But really don't like this patch. The mddev_unlock is strange,
> r5c_disable_writeback_async could skip disabling writeback too. Could we add a
> new callback like .prepare_free, and flush workqueue there. After we drop the
> reconfig_mutex in do_md_stop, we call the prepare_free. We can probably set a
> flag, so later r5c_disable_writeback_async will bail out doing nothing. I think
> this should work, right?
Might work, though it sounds more messy to me (assuming I understand).
I would like to get rid of disable_writeback_work altogether.
Just set log->r5c_journal_mode = R5C_JOURNAL_MODE_WRITE_THROUGH in
r5c_update_on_rdev_error(), and make sure that does the right thing.
The distinction between write-through and write-back should be able to
be a per-stripe_head distinction. Once we set r5c_journal_mode, new
stripe_heads will get the new mode, old ones are allowed to continue how
they are.
Maybe we could keep a counter of how many stripes are in WRITE_BACK
mode, and test that counter in r5c_is_writeback()??
I don't know what all the issues are so it would need careful review,
preferably by someone familiar with the code.
Short of that, I think my current patch is the best interim step. I
agree that it isn't the most elegant thing ever, but it is localized and
I believe it works correctly.
The "mddev_unlock()" shouldn't look too strange, it perfectly balances
he mddev_try_lock().
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-10-23 0:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 2:46 [md PATCH 0/5] Address deadlock associated with setting suspend_lo NeilBrown
2017-10-17 2:46 ` [md PATCH 3/5] md: move suspend_hi/lo handling into core md code NeilBrown
2017-10-18 6:16 ` Shaohua Li
2017-10-18 7:40 ` NeilBrown
2017-10-19 1:49 ` [md PATCH 6/5] md: remove special meaning of ->quiesce(.., 2) NeilBrown
2017-10-17 2:46 ` [md PATCH 2/5] md: don't call bitmap_create() while array is quiesced NeilBrown
2017-10-17 2:46 ` [md PATCH 5/5] md: allow metadata update while suspending NeilBrown
2017-10-17 2:46 ` [md PATCH 4/5] md: use mddev_suspend/resume instead of ->quiesce() NeilBrown
2017-10-17 2:46 ` [md PATCH 1/5] md: always hold reconfig_mutex when calling mddev_suspend() NeilBrown
2017-10-18 6:11 ` Shaohua Li
2017-10-18 7:35 ` NeilBrown
2017-10-19 1:17 ` [md PATCH 1/5 v2] " NeilBrown
2017-10-19 3:45 ` Shaohua Li
2017-10-19 6:29 ` NeilBrown
2017-10-20 4:37 ` Shaohua Li
2017-10-23 0:02 ` NeilBrown [this message]
2017-10-23 1:48 ` Shaohua Li
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=87sheaenow.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).