[dm-devel] [PATCH v2 17/20] multipath.rules: find_multipaths "smart" logic

Martin Wilck mwilck at suse.com
Thu Mar 29 09:15:08 UTC 2018


On Thu, 2018-03-29 at 08:04 +0200, Hannes Reinecke wrote:
> 
> > The only way I see to avoid this is to try calling open(O_EXCL) on
> > the
> > path device in "multipath -u". So far we've avoided that because
> > it's
> > not completely race-free. But we're not talking about a race here,
> > but
> > a situation where some entity grabbed a device before pivot-root.
> > So we could attempt open(O_EXCL) only in the "is maybe a valid
> > path"
> > case, and only return "maybe" if that open succeeds. Otherwise we'd
> > return "no", as we already checked that the device isn't currently
> > part of a multipath map.
> > 
> 
> Ho-hum.
> 
> Watch out when you do this; systemd will generate another event
> whenever you close this fd, and suddenly you find yourself in a
> middle
> of an event storm ...

Thanks for mentioning that.

Udev listens for inotify events for "close after write". We will do the
test with O_RDONLY|O_EXCL, so no event should be generated. Moreover,
events should only occur if udev is watching the device, which
shouldn't be the case while an event is processed (but I'm not 100%
certain about that). Anyway, I'll test this.
 
Cheers,
Martin

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)




More information about the dm-devel mailing list