On Mon, 18.05.15 16:08, Martin Pitt (martin.p...@ubuntu.com) wrote: > Martin Pitt [2015-05-17 15:54 +0200]: > > This fixes the original "systemd immediately unmounts my mounts" bug, > > but not for very long: If you remount or unmount just one mount on a > > tentative device, mountinfo changes, and device_found_node() now calls > > device_update_found_one() with "add == 0". Then > > > > n = add ? (d->found | found) : (d->found & ~found); > > > > would unset the previous DEVICE_FOUND_MOUNT flag, leaving 0 (i. e. > > DEVICE_NOT_FOUND). Thus the previously "tentative" device would once > > again be set to "dead", and systemd would unmount all other mounts > > from it. This must never happen, we simply can't declare tentative > > devices as dead and clean up their unmounts, this only works for > > "plugged" ones that we know via udev. > > Eek, I attached the wrong 0002- patch, sorry about that. The above is > fixed by the attached patch, please ignore 0002- from the previous > mail. For completeness I also re-attach 0001- again (unchanged).
Still not getting what the purpose of the 0002 patch is, even in this revision... Please elaborate! > --- a/src/core/device.c > +++ b/src/core/device.c > @@ -465,12 +465,13 @@ static void device_update_found_one(Device *d, bool > add, DeviceFound found, bool > * now referenced by the kernel, then we assume the > * kernel knows it now, and udev might soon too. */ > device_set_state(d, DEVICE_TENTATIVE); > - else > - /* If nobody sees the device, or if the device was > - * previously seen by udev and now is only referenced > - * from the kernel, then we consider the device is > + else if (previous & DEVICE_FOUND_UDEV) > + /* If the device was previously seen by udev and now is only > + * referenced from the kernel, then we consider the device is > * gone, the kernel just hasn't noticed it yet. */ > device_set_state(d, DEVICE_DEAD); > + /* We never move from TENTATIVE to DEAD, as we can only determine > this > + * status update with udev, not with mountinfo */ > } Devices that show up in /proc/self/mountinfo or /proc/swap, and then disappear again, without ever showing up in udev, need to be cleaned up. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel