All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Benjamin Marzinski <bmarzins@redhat.com>
Cc: device-mapper development <dm-devel@redhat.com>,
	Kay Sievers <kay.sievers@vrfy.org>,
	systemd Mailing List <systemd-devel@lists.freedesktop.org>,
	Mike Snitzer <snitzer@redhat.com>
Subject: Re: [dm-devel] multipath breaks with recent udev/systemd
Date: Wed, 17 Dec 2014 13:04:54 +0100	[thread overview]
Message-ID: <54917166.6020406@suse.de> (raw)
In-Reply-To: <20141216221856.GL30600@ask-08.lab.msp.redhat.com>

On 12/16/2014 11:18 PM, Benjamin Marzinski wrote:
> On Tue, Dec 16, 2014 at 04:10:44PM -0600, Benjamin Marzinski wrote:
>> On Mon, Dec 15, 2014 at 10:31:44AM +0100, Hannes Reinecke wrote:
[ .. ]
>>> So during bootup it's anyone's guess who's first, multipath or udev.
>>> And depending on the timing either multipath will fail to setup
>>> the device-mapper device or udev will simply ignore the device.
>>> Neither of those is a good, but the first is an absolute killer for
>>> modern systems which _rely_ on udev to configure devices.
>>>
>>> So how it this supposed to work?
>>> Why does udev ignore the entire event if it can't get the lock?
>>> Shouldn't it rather be retried?
>>> What is the supposed recovery here?
>>
>> Hannes, are you against the idea that Alexander mentioned in his first
>> email, of just locking a file in /var/lock?  Multipathd doesn't create
>> devices in parallel. Multipath doesn't create files in parallel.  We are
>> explicitly trying to avoid multipath and multipathd creating files at
>> the same time. So, we should only need a single file to lock, and
>> /run/lock should always be there.
> 
> O.k. So if we want to keep our current nonblocking behavior, we'll need
> more lockfiles, either one per path or one per wwid.  This still seems
> like a reasonable idea, if there is a good reason for systemd doing what
> it's doing.
> 
The problem is as follows:

When multipathd is running we simply _cannot_ guarantee that no udev
events are currently running. This currently hits us especially bad
during system startup when device probing is still running during
multipathd startup.
Multipathd will then enumerate all block devices to setup the
initial topology.
But in doing so it might trip over device which are still processed
by udev (or, worse still, _not yet_ processed by udev).
(Yes, I know, libudev_enumerate should protect against this.
 But it doesn't. )

So it's anyone guess what'll happen now; either multipath trips over
the lock from udev when calling 'lock_multipath' (and consequently
failing to setup the multipath device), or udev
tripping over the lock from multipath and ignoring the event,
leaving us with a non-functioning device.

We can fixup the startup sequence (which we need to do anyway, given
the libudev enumerate bug) to just re-trigger all block device
events, but this still doesn't fix the actual issue.
Point is, there might be _several_ events for the same device being
queued (think of a flaky path with several PATH_FAILED /
PATH_REINSTATED events in a row), and so multipathd might be
processing one event for the device while udev is processing the
next event for the same device.

For this to work we need some synchronization with udev; _if_ there
would be a libudev callout for 'is there an event for this device
running' we can easily fail the 'lock_multipath' operation, knowing
that we'll be getting another event shortly for the same device.

Alternatively we can call flock(LOCK_EX) on that device, but that
will only work if udev would _not_ abort event handling for that
device, but rather issues a retry.
After all, there _is_ a device timeout in udev. It should be
relatively easy to retry the event and let it run into a timeout if
the lock won't be released.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

  reply	other threads:[~2014-12-17 12:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15  9:31 multipath breaks with recent udev/systemd Hannes Reinecke
2014-12-15 12:53 ` Alexander E. Patrakov
2014-12-16 22:10 ` Benjamin Marzinski
2014-12-16 22:18   ` [dm-devel] " Benjamin Marzinski
2014-12-17 12:04     ` Hannes Reinecke [this message]
2014-12-18 20:18       ` Kay Sievers
2014-12-18 22:04       ` Benjamin Marzinski
2014-12-19  7:21         ` Hannes Reinecke
2014-12-19 15:16           ` 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=54917166.6020406@suse.de \
    --to=hare@suse.de \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=kay.sievers@vrfy.org \
    --cc=snitzer@redhat.com \
    --cc=systemd-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.