From 0ef4118c7825fe1f3a317e1f708d10ec831e8e83 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 20 Oct 2025 15:18:42 +0200 Subject: [PATCH] homed: switch from raw BLKRRPART to rereadpt_fd() --- src/home/homework-luks.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index a0b4368a2a..25b3c191dd 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -53,6 +53,7 @@ #include "path-util.h" #include "process-util.h" #include "random-util.h" +#include "reread-partition-table.h" #include "resize-fs.h" #include "string-util.h" #include "strv.h" @@ -2497,7 +2498,7 @@ int home_create_luks( if (disk_uuid_path) /* Reread partition table if this is a block device */ - (void) ioctl(setup->image_fd, BLKRRPART, 0); + (void) reread_partition_table_fd(setup->image_fd, /* flags= */ 0); else { assert(setup->temporary_image_path); @@ -3469,8 +3470,8 @@ int home_resize_luks( if (r > 0) log_info("Growing of partition completed."); - if (S_ISBLK(st.st_mode) && ioctl(image_fd, BLKRRPART, 0) < 0) - log_debug_errno(errno, "BLKRRPART failed on block device, ignoring: %m"); + if (S_ISBLK(st.st_mode)) + (void) reread_partition_table_fd(image_fd, /* flags= */ 0); /* Tell LUKS about the new bigger size too */ r = sym_crypt_resize(setup->crypt_device, setup->dm_name, new_fs_size / 512U); @@ -3569,8 +3570,8 @@ int home_resize_luks( if (r > 0) log_info("Shrinking of partition completed."); - if (S_ISBLK(st.st_mode) && ioctl(image_fd, BLKRRPART, 0) < 0) - log_debug_errno(errno, "BLKRRPART failed on block device, ignoring: %m"); + if (S_ISBLK(st.st_mode)) + (void) reread_partition_table_fd(image_fd, /* flags= */ 0); } else { /* → Grow */ if (!FLAGS_SET(flags, HOME_SETUP_RESIZE_DONT_SYNC_IDENTITIES)) {