]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
swap: tell swapon to reinitialize swap if needed
authorDavid Tardon <dtardon@redhat.com>
Mon, 12 Dec 2022 15:21:30 +0000 (16:21 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Dec 2022 14:48:10 +0000 (15:48 +0100)
If the page size of a swap space doesn't match the page size of the
currently running kernel, swapon will fail. Let's instruct it to
reinitialize the swap space instead.

src/core/swap.c

index 2196793ad10a469b348fbf9ae4e7eb8e5e0a9eea..5c83c4780f58b745b6a9e8210bcf768ab03f9de0 100644 (file)
@@ -827,7 +827,7 @@ static void swap_enter_activating(Swap *s) {
                 }
         }
 
-        r = exec_command_set(s->control_command, "/sbin/swapon", NULL);
+        r = exec_command_set(s->control_command, "/sbin/swapon", "--fixpgsz", NULL);
         if (r < 0)
                 goto fail;