From: NeilBrown <neilb@suse.com>
To: Guoqing Jiang <gqjiang@suse.com>
Cc: linux-raid@vger.kernel.org, rgoldwyn@suse.com
Subject: Re: [PATCH V3 2/2] md-cluster: Protect communication with mutexes
Date: Mon, 30 Nov 2015 11:58:41 +1100 [thread overview]
Message-ID: <87mvtw5mm6.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1448818989-8280-1-git-send-email-gqjiang@suse.com>
[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]
On Mon, Nov 30 2015, Guoqing Jiang wrote:
> +#define MD_CLUSTER_SEND_LOCK 4
> +/* If cluster operations must lock the communication channel,
> + * so as to perform extra operations (and no other operation
> + * is allowed on the MD, such as adding a disk. Token needs
> + * to be locked and held until the operation completes with
> + * a md_update_sb(), which would eventually release the lock.
> + */
This comment has unbalanced parentheses. How did it even compile :-)
But there is something else that isn't as clear as it could be....
>
> @@ -970,14 +1019,18 @@ static int add_new_disk(struct mddev *mddev, struct md_rdev *rdev)
> ret = -ENOENT;
> if (ret)
> unlock_comm(cinfo);
> - else
> + else {
> dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_CR);
> + set_bit(MD_CLUSTER_SEND_LOCKED_ALREADY, &cinfo->state);
> + wake_up(&cinfo->wait);
> + }
This code suggests that something has caused a metadata update to be
triggered. i.e. something set MD_CHANGE_DEVS or similar.
That is presumably add_bound_rdev() - which hasn't yet been called, but
while soon after in add_new_disk().
This feels a little bit fragile. The new code in md-cluster is only
correct if code in add_new_disk does a particular thing. I guess I'd at
least like to see a comment in add_new_disk() in md-cluster explaining
what will cause MD_CLUSTE_SEND_LOCKED_ALREADY to eventually be cleared.
Maybe it could also schedule the MD_CHANGE_DEVS to be completely certain
that will happen, but that probably isn't necessary.
So I've applied these for now, but if you could fix one comment and add
another that would help.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next prev parent reply other threads:[~2015-11-30 0:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-29 8:57 [PATCH Resend V2 1/2] md-cluster: Defer MD reloading to mddev->thread Guoqing Jiang
2015-11-29 8:57 ` [PATCH Resend V2 2/2] md-cluster: Protect communication with mutexes Guoqing Jiang
2015-11-29 17:43 ` [PATCH V3 " Guoqing Jiang
2015-11-30 0:58 ` NeilBrown [this message]
2015-11-30 15:09 ` Guoqing Jiang
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=87mvtw5mm6.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=gqjiang@suse.com \
--cc=linux-raid@vger.kernel.org \
--cc=rgoldwyn@suse.com \
/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).