From: Bart Van Assche <Bart.VanAssche@wdc.com>
To: "bmarzins@redhat.com" <bmarzins@redhat.com>,
"dm-devel@redhat.com" <dm-devel@redhat.com>
Cc: "mwilck@suse.com" <mwilck@suse.com>
Subject: Re: [PATCH 1/7] multipath: fix tur checker locking
Date: Thu, 8 Feb 2018 18:19:32 +0000 [thread overview]
Message-ID: <1518113970.3611.58.camel@wdc.com> (raw)
In-Reply-To: <1518043787-7066-2-git-send-email-bmarzins@redhat.com>
On Wed, 2018-02-07 at 16:49 -0600, Benjamin Marzinski wrote:
> Commit 6e2423fd fixed a bug where the tur checker could cancel a
> detached thread after it had exitted. However in fixing this, the new
> code grabbed a mutex (to call condlog) while holding a spin_lock. To
> deal with that, and to try to keep with the maixim "lock data, not
> code", I've changed how the tur checker synchronizes with its thread.
>
> Now, the tur checker creates joinable threads, and detaches them when
> the thread is finished or has timed out. To track the state of the
> threads, I've added a new variable to the checker context, ct->attached.
> When a thread starts, attached is set to 1. When the thread finishes, it
> saves the value of attached, and then zeros it out, while locked. If
> attached was set, it detaches itself.
>
> When the tur checker gives up on a thread, it also saves and decrements
> ct->attached, while locked. At the same time it saves the value of
> ct->thread. If attached was set, it cancels the thread, and then
> detaches it.
>
> So the values that are protected by the spin lock are now ct->holders,
> ct->thread, and ct->attached. There are cases where the tur checker just
> wants to know if the thread is running. If so, its safe to simply read
> ct->thread without locking. Also, if it knows that the thread isn't
> running, it can freely access all of these variables. I've left the
> locking in-place in these cases to make the static analyzers happy.
> However I have added comments stating when the locking isn't actually
> necessary.
Hello Ben,
Have you considered to move the condlog() statements out of the spinlock
section? I think that would lead to a much smaller and less contrived change
than the patch you posted.
Thanks,
Bart.
next prev parent reply other threads:[~2018-02-08 18:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-07 22:49 [PATCH 0/7] multipath: miscellaneous bug fixes Benjamin Marzinski
2018-02-07 22:49 ` [PATCH 1/7] multipath: fix tur checker locking Benjamin Marzinski
2018-02-08 8:49 ` Martin Wilck
2018-02-08 17:52 ` Benjamin Marzinski
2018-02-08 18:20 ` Bart Van Assche
2018-02-08 18:19 ` Bart Van Assche [this message]
2018-02-08 19:27 ` Benjamin Marzinski
2018-02-08 19:34 ` Bart Van Assche
2018-02-07 22:49 ` [PATCH 2/7] multipath: fix DEF_TIMEOUT use Benjamin Marzinski
2018-02-08 8:52 ` Martin Wilck
2018-02-07 22:49 ` [PATCH 3/7] multipathd: remove coalesce_paths from ev_add_map Benjamin Marzinski
2018-02-08 9:10 ` Martin Wilck
2018-02-08 18:00 ` Benjamin Marzinski
2018-02-07 22:49 ` [PATCH 4/7] multipathd: remove unused configure parameter Benjamin Marzinski
2018-02-08 9:13 ` Martin Wilck
2018-02-07 22:49 ` [PATCH 5/7] Fix set_no_path_retry() regression Benjamin Marzinski
2018-02-08 9:21 ` Martin Wilck
2018-02-08 18:31 ` Benjamin Marzinski
2018-02-07 22:49 ` [PATCH 6/7] multipathd: change spurious uevent msg priority Benjamin Marzinski
2018-02-08 9:23 ` Martin Wilck
2018-02-07 22:49 ` [PATCH 7/7] multipath: print sysfs state in fast list mode Benjamin Marzinski
2018-02-08 9:32 ` Martin Wilck
2018-02-08 19:06 ` Benjamin Marzinski
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=1518113970.3611.58.camel@wdc.com \
--to=bart.vanassche@wdc.com \
--cc=bmarzins@redhat.com \
--cc=dm-devel@redhat.com \
--cc=mwilck@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