]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
reread-partition-table: fix error code check
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 9 Nov 2025 01:14:11 +0000 (10:14 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 9 Nov 2025 09:12:38 +0000 (18:12 +0900)
flock() sets EAGAIN rather than EBUSY when a node is already locked.

Follow-up for d8e38d4aaac23cb27cc7e0f410449c3a6034db4f.
Fixes #39544.

src/shared/reread-partition-table.c

index 9f9fa7d94cebee75daa8fe12d4ab0399eaf3d8c9..d95e2864c4472cd933765a9daf526740f0a92f4f 100644 (file)
@@ -262,7 +262,7 @@ static int reread_partition_table_full(sd_device *dev, int fd, RereadPartitionTa
                 if (flock(lock_fd, LOCK_EX|LOCK_NB) < 0) {
                         r = log_device_debug_errno(dev, errno, "Failed to take BSD lock on block device '%s': %m", p);
 
-                        if (r == -EBUSY && FLAGS_SET(flags, REREADPT_FORCE_UEVENT)) {
+                        if (r == -EAGAIN && FLAGS_SET(flags, REREADPT_FORCE_UEVENT)) {
                                 log_device_debug(dev, "Giving up rereading partition table of '%s'. Triggering change events for the device and its partitions.", p);
                                 (void) trigger_partitions(dev, /* blkrrpart_success= */ false);
                         }