]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/device.c
device: make sure to not ignore re-plugged device 2412/head
authorFranck Bui <fbui@suse.com>
Fri, 22 Jan 2016 06:18:19 +0000 (07:18 +0100)
committerFranck Bui <fbui@suse.com>
Fri, 22 Jan 2016 12:53:00 +0000 (13:53 +0100)
commitac9d396b2abbae4e7ab84f7b556f70681b66236b
tree40f5de3c22988d4ef3d097e45570dc5ed5af2cca
parentca9ec350f39096f19d6672e38ca2419877627a4b
device: make sure to not ignore re-plugged device

systemd automatically mounts device unless 'noauto' is part of the
mount options. This can happen during boot if the device is plugged at
that time or later when the system is already running (the latter case
is not documented AFAICS).

After the systemd booted, I plugged my USB device which had an entry
in /etc/fstab with the default options and systemd automatically
mounted it.

However I noticed that if I unplugged and re-plugged the device the
automatic mounting of the device didn't work anymore: systemd didn't
notice that the device was re-plugged.

This was due to the device unit which was not recycled by the GC
during the unplug event because in the case of automounting, the mount
unit still referenced it. When the device was re-plugged, the old
device unit was reused but it still had the old sysfs path (amongst
other useful information).

Systemd was confused by the stalled sysfs path and decided to ignore
the plug event.

This patch fixes this issue by simply not doing the sanity checking on
the sysfs path if the device is in unplugged state.
src/core/device.c