When not editing a blockdev, syncing disks provides no benefit (we already fsync() above), takes a long time, and affects unrelated caches. BLKRRPART is similarly gated on !S_ISBLK(st_mode) in fdisk_reread_partition_table. --- Based on the 2.39 tarball. diff '--color=auto' -ru util-linux-2.39.orig/libfdisk/src/context.c util-linux-2.39/libfdisk/src/context.c --- util-linux-2.39.orig/libfdisk/src/context.c 2023-05-11 10:24:24.840187437 +0200 +++ util-linux-2.39/libfdisk/src/context.c 2024-01-13 23:25:56.358057182 +0100 @@ -773,7 +773,7 @@ cxt->dev_path); return -errno; } - if (!nosync) { + if (S_ISBLK(cxt->dev_st.st_mode) && !nosync) { fdisk_info(cxt, _("Syncing disks.")); sync(); }
Attachment:
signature.asc
Description: PGP signature