]> sourceware.org Git - lvm2.git/commitdiff
libdm: clean up udev sync semaphore on fail path during its creation
authorPeter Rajnoha <prajnoha@redhat.com>
Mon, 12 Aug 2024 12:16:32 +0000 (14:16 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Thu, 5 Sep 2024 10:14:42 +0000 (12:14 +0200)
Clean up udev sync semaphore on fail path during its creation, otherwise
the caller will have no handle returned to clean it up itself and the
semaphore will keep staying in the system. The only way to clean it up
would be to call `dmsetup udevcomplete_all` which would destroy all
udev sync semaphores, not just the failed one, which we don't want.

device_mapper/libdm-common.c
libdm/libdm-common.c

index eb722c686fa7b64ecb77dfb3aef13b658297704d..db7c75277a839a5f88d44142146d53599539d625 100644 (file)
@@ -2574,6 +2574,7 @@ static int _udev_notify_sem_create(uint32_t *cookie, int *semid)
                log_error("cookie create: semid %d: sem_ctl GETVAL failed for "
                          "cookie 0x%" PRIx32 ": %s",
                          gen_semid, gen_cookie, strerror(errno));
+               (void) _udev_notify_sem_destroy(gen_cookie, gen_semid);
                goto bad;
        }
 
index 445b79c179fd30a45f33dc493ecaf432e07d25f8..4054d6cc0ab58b6cc0ac76664ecdc0bb6b84f832 100644 (file)
@@ -2573,6 +2573,7 @@ static int _udev_notify_sem_create(uint32_t *cookie, int *semid)
                log_error("cookie create: semid %d: sem_ctl GETVAL failed for "
                          "cookie 0x%" PRIx32 ": %s",
                          gen_semid, gen_cookie, strerror(errno));
+               (void) _udev_notify_sem_destroy(gen_cookie, gen_semid);
                goto bad;
        }
 
This page took 0.04002 seconds and 5 git commands to generate.