From: Lennart Poettering Date: Mon, 15 Nov 2021 20:40:04 +0000 (+0100) Subject: homed: reset HomeSetup.undo_dm field when deactivating home dir the official way X-Git-Tag: v250-rc1~253 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=228b1decc6fdfaf6e05047cfddad5e2bd343b222;p=thirdparty%2Fsystemd.git homed: reset HomeSetup.undo_dm field when deactivating home dir the official way 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) --- diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index 7275b231cc7..20fbf627015 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -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