Hello all,

Martin Pitt [2015-03-01 12:43 +0100]:
> Lennart Poettering [2015-02-28 17:40 +0100]:
> > This is implemented now. Please check if this fixes this issue for
> > you.
> 
> This fixes the bad unmounts at boot, but also breaks the automatic cleanup of
> stale mounts after CD ejection.
> [...]
> but after ejecting the mount still stays around. The device unit does
> to activating/tentative, and the .mount unit is unchanged from the above.
> Supposedly this line is the interesting one:
> 
>   systemd[1]: dev-sr1.device changed plugged -> tentative
> 
> which in this case really should become "dead". The full debug journal
> is at http://people.canonical.com/~pitti/tmp/journal-cd-eject.txt

The attached patch fixes that. I tested CD ejection, the cleanup
unmount works properly again. I also verified that mounts done in the
initramfs (i. e. "tentative" device state) are still kept around
without unmounting them.

Thanks,

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
From 05ffa415fa4f75f2e71830d47179b6f4a67c7215 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.p...@ubuntu.com>
Date: Fri, 13 Mar 2015 08:23:02 +0100
Subject: [PATCH] core: don't change removed devices to state "tentative"

Commit 628c89c introduced the "tentative" device state, which caused devices to
go from "plugged" to "tentative" on a remove uevent. This breaks the cleanup
of stale mounts (see commit 3b48ce4), as that only applies to "dead" devices.

The "tentative" state only really makes sense on adding a device when we don't
know where it was coming from (i. e. not from udev). But when we get a device
removal from udev we definitively know that it's gond, so change the device
state back to "dead" as before 628c89c.
---
 src/core/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/device.c b/src/core/device.c
index 6b489a4..098a000 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -419,7 +419,7 @@ static void device_update_found_one(Device *d, bool add, DeviceFound found, bool
         if (now) {
                 if (d->found & DEVICE_FOUND_UDEV)
                         device_set_state(d, DEVICE_PLUGGED);
-                else if (d->found != DEVICE_NOT_FOUND)
+                else if (add && d->found != DEVICE_NOT_FOUND)
                         device_set_state(d, DEVICE_TENTATIVE);
                 else
                         device_set_state(d, DEVICE_DEAD);
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to