]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homed: reset HomeSetup.undo_dm field when deactivating home dir the official way
authorLennart Poettering <lennart@poettering.net>
Mon, 15 Nov 2021 20:40:04 +0000 (21:40 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Nov 2021 01:35:09 +0000 (10:35 +0900)
There are two ways to deactivate a home dir: the official way if someone
calls "homectl deactivate" or something similar. Or the
error-case/side-effect code path, where we unwind exactly what we
already set up.

The .undo_dm field is supposed to tell us whether we shall still detach
the DM device. We forgot to update it in the official code path. Add
that. (We did it correctly in the error case codepath already).

(The issue is minor: if we forget to reset it in the clean code path,
then we'll try to unmount again what is already unmounted in the error
code paths, but since we ignore errors there — to not "stack" errors –
we never noticed and there's no bad effect of it)

src/home/homework-luks.c

index 7275b231cc7ad7f0094e34f57cfd5411a5c599fd..20fbf6270156df0242a80eeac7a7939a741fd536 100644 (file)
@@ -1509,6 +1509,8 @@ int home_deactivate_luks(UserRecord *h, HomeSetup *setup) {
                 }
         }
 
+        setup->undo_dm = false;
+
         if (user_record_luks_offline_discard(h))
                 log_debug("Not allocating on logout.");
         else