Re: [PATCH 13/35] monitor: disable nvmf-autoconnect udev rules in autoconnect mode

Martin Wilck
2021-01-29T14:17:01Z

On Thu, 2021-01-28 at 17:52 -0800, Sagi Grimberg wrote:
>
>
> On 1/26/21 12:33 PM, mwilck@suse.com wrote:
> > From: Martin Wilck <mwilck@suse.com>
> >
> > If autoconnect is enabled, disable the respective udev rules
> > by symlinking /run/udev/rules.d to /dev/null, in order to avoid
> > the connections being set up by the monitor and the udev workers
> > at the same time. This is probably the preferred mode of operation
> > for the monitor.
> >
> > Users can override this by copying 70-nvmf-autoconnect.rules
> > from /usr/lib/udev/rules.d to /etc/udev/rules.d (/etc/udev/rules.d
> > takes precedence over /run/udev/rules.d).
> >
> > If the symlink can't be created for some reason, autoconnect will
> > be disabled. There is  only one exception: If
> > /run/udev/rules.d/70-nvmf-autoconnect.rules already points to
> > /dev/null at startup, autoconnect can be left on, but the symlink
> > isn't removed on exit.
>
> Can't we just document that just one should be enabled and skip
> the entire thing? Especially when its not critical if both run..

It's not critical, but it makes no sense to have the rules enabled when
the monitor runs. And having to mask/unmask them manually is a pain.

It could be done in the systemd service file using ExecStartPre /
ExecStopPost, with small restrictions (we couldn't distinguish whether
the rules were already masked before we started). That would be more
transparent for users.

I'm ok with not doing it automatically if that's generally preferred.

Regards
Martin