From: Philipp Reisner <philipp.reisner@linbit.com>
To: drbd-dev@lists.linbit.com
Subject: Re: [Drbd-dev] [DRBD 8.0 PATCH] Update state processing so that after-state-change is always done in worker thread
Date: Tue, 15 Jan 2008 10:14:07 +0100 [thread overview]
Message-ID: <200801151014.07561.philipp.reisner@linbit.com> (raw)
In-Reply-To: <342BAC0A5467384983B586A6B0B3767107C5AF5E@EXNA.corp.stratus.com>
Am Freitag, 11. Januar 2008 16:22:15 schrieb Graham, Simon:
> This patch updates the state processing so that the after state change
> processing is always done on the worker thread - my main motivation for
> this was to ensure that state change notifications are never re-ordered.
>
>
> This also involves the following:
> 1. starting the worker thread is done inline in drbd_set_state
> 2. the worker will be started whenever it is needed rather than
> only when certain states are reached.
> 3. Marking the meta data dirty is done inline in drbd_set_state
>
> Simon
Hi Simon,
I definitely want to pick up that one, here are my notes from my
first review:
> @@ -818,19 +830,18 @@ int _drbd_set_state(drbd_dev* mdev, drbd_state_t
> ns,enum chg_state_flags flags) os.peer == Secondary && ns.peer == Primary)
> set_bit(CONSIDER_RESYNC, &mdev->flags);
>
> - if( flags & ScheduleAfter ) {
> - struct after_state_chg_work* ascw;
> -
> - ascw = kmalloc(sizeof(*ascw), GFP_ATOMIC);
> - if(ascw) {
> - ascw->os = os;
> - ascw->ns = ns;
> - ascw->flags = flags;
> - ascw->w.cb = w_after_state_ch;
> - drbd_queue_work(&mdev->data.work,&ascw->w);
> - } else {
> - WARN("Could not kmalloc an ascw\n");
> - }
> + /* Make sure worker thread is running -- this is a NOP if it is already running */
> + drbd_thread_start(&mdev->worker);
> +
It is not allowed to call drbd_thread_start() while we are in _drbd_set_state(),
because drbd_thread_start() uses a sleeping function (wait_for_completion()).
And _drbd_set_state() is running with the req_lock hold.
But I think that can be easily took out of _drbd_set_state(), and done in the
context of the netlink connector callbacks.
I will prepare that...
-Phil
--
: Dipl-Ing Philipp Reisner Tel +43-1-8178292-50 :
: LINBIT Information Technologies GmbH Fax +43-1-8178292-82 :
: Vivenotgasse 48, 1120 Vienna, Austria http://www.linbit.com :
next prev parent reply other threads:[~2008-01-15 9:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-11 15:22 [Drbd-dev] [DRBD 8.0 PATCH] Update state processing so that after-state-change is always done in worker thread Graham, Simon
2008-01-14 9:05 ` Lars Ellenberg
2008-01-15 9:14 ` Philipp Reisner [this message]
2008-01-15 13:50 ` Graham, Simon
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=200801151014.07561.philipp.reisner@linbit.com \
--to=philipp.reisner@linbit.com \
--cc=drbd-dev@lists.linbit.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