From: Lennart Poettering Date: Mon, 20 Oct 2025 13:18:42 +0000 (+0200) Subject: homed: switch from raw BLKRRPART to rereadpt_fd() X-Git-Tag: v259-rc1~259^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0ef4118c7825fe1f3a317e1f708d10ec831e8e83;p=thirdparty%2Fsystemd.git homed: switch from raw BLKRRPART to rereadpt_fd() --- diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index a0b4368a2aa..25b3c191dda 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)) {