1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: add 'cookie create/inc/dec' log prefix if GETVAL fails for udev sync ops

The same message is printed while performing create/inc/dec operation and
the GETVAL semctl fails. Add a prefix so we know exactly in which of
these functions the issue actually happened.
This commit is contained in:
Peter Rajnoha 2024-08-12 14:01:25 +02:00
parent 80d7483322
commit de196f4b60
No known key found for this signature in database
GPG Key ID: E776664036DF84AB
2 changed files with 16 additions and 16 deletions

View File

@ -2437,16 +2437,16 @@ static int _udev_notify_sem_inc(uint32_t cookie, int semid)
int val; int val;
if (semop(semid, &sb, 1) < 0) { if (semop(semid, &sb, 1) < 0) {
log_error("semid %d: semop failed for cookie 0x%" PRIx32 ": %s", log_error("cookie inc: semid %d: semop failed for cookie 0x%" PRIx32 ": %s",
semid, cookie, strerror(errno)); semid, cookie, strerror(errno));
return 0; return 0;
} }
if ((val = semctl(semid, 0, GETVAL)) < 0) { if ((val = semctl(semid, 0, GETVAL)) < 0) {
log_error("semid %d: sem_ctl GETVAL failed for " log_error("cookie inc: semid %d: sem_ctl GETVAL failed for "
"cookie 0x%" PRIx32 ": %s", "cookie 0x%" PRIx32 ": %s",
semid, cookie, strerror(errno)); semid, cookie, strerror(errno));
return 0; return 0;
} }
log_debug_activation("Udev cookie 0x%" PRIx32 " (semid %d) incremented to %d", log_debug_activation("Udev cookie 0x%" PRIx32 " (semid %d) incremented to %d",
@ -2461,7 +2461,7 @@ static int _udev_notify_sem_dec(uint32_t cookie, int semid)
int val; int val;
if ((val = semctl(semid, 0, GETVAL)) < 0) { if ((val = semctl(semid, 0, GETVAL)) < 0) {
log_error("semid %d: sem_ctl GETVAL failed for " log_error("cookie dec: semid %d: sem_ctl GETVAL failed for "
"cookie 0x%" PRIx32 ": %s", "cookie 0x%" PRIx32 ": %s",
semid, cookie, strerror(errno)); semid, cookie, strerror(errno));
return 0; return 0;
@ -2470,13 +2470,13 @@ static int _udev_notify_sem_dec(uint32_t cookie, int semid)
if (semop(semid, &sb, 1) < 0) { if (semop(semid, &sb, 1) < 0) {
switch (errno) { switch (errno) {
case EAGAIN: case EAGAIN:
log_error("semid %d: semop failed for cookie " log_error("cookie dec: semid %d: semop failed for cookie "
"0x%" PRIx32 ": " "0x%" PRIx32 ": "
"incorrect semaphore state", "incorrect semaphore state",
semid, cookie); semid, cookie);
break; break;
default: default:
log_error("semid %d: semop failed for cookie " log_error("cookie dec: semid %d: semop failed for cookie "
"0x%" PRIx32 ": %s", "0x%" PRIx32 ": %s",
semid, cookie, strerror(errno)); semid, cookie, strerror(errno));
break; break;
@ -2563,7 +2563,7 @@ static int _udev_notify_sem_create(uint32_t *cookie, int *semid)
sem_arg.val = 1; sem_arg.val = 1;
if (semctl(gen_semid, 0, SETVAL, sem_arg) < 0) { if (semctl(gen_semid, 0, SETVAL, sem_arg) < 0) {
log_error("semid %d: semctl failed: %s", gen_semid, strerror(errno)); log_error("cookie create: semid %d: semctl failed: %s", gen_semid, strerror(errno));
/* We have to destroy just created semaphore /* We have to destroy just created semaphore
* so it won't stay in the system. */ * so it won't stay in the system. */
(void) _udev_notify_sem_destroy(gen_cookie, gen_semid); (void) _udev_notify_sem_destroy(gen_cookie, gen_semid);
@ -2571,7 +2571,7 @@ static int _udev_notify_sem_create(uint32_t *cookie, int *semid)
} }
if ((val = semctl(gen_semid, 0, GETVAL)) < 0) { if ((val = semctl(gen_semid, 0, GETVAL)) < 0) {
log_error("semid %d: sem_ctl GETVAL failed for " log_error("cookie create: semid %d: sem_ctl GETVAL failed for "
"cookie 0x%" PRIx32 ": %s", "cookie 0x%" PRIx32 ": %s",
gen_semid, gen_cookie, strerror(errno)); gen_semid, gen_cookie, strerror(errno));
goto bad; goto bad;

View File

@ -2436,16 +2436,16 @@ static int _udev_notify_sem_inc(uint32_t cookie, int semid)
int val; int val;
if (semop(semid, &sb, 1) < 0) { if (semop(semid, &sb, 1) < 0) {
log_error("semid %d: semop failed for cookie 0x%" PRIx32 ": %s", log_error("cookie inc: semid %d: semop failed for cookie 0x%" PRIx32 ": %s",
semid, cookie, strerror(errno)); semid, cookie, strerror(errno));
return 0; return 0;
} }
if ((val = semctl(semid, 0, GETVAL)) < 0) { if ((val = semctl(semid, 0, GETVAL)) < 0) {
log_error("semid %d: sem_ctl GETVAL failed for " log_error("cookie inc: semid %d: sem_ctl GETVAL failed for "
"cookie 0x%" PRIx32 ": %s", "cookie 0x%" PRIx32 ": %s",
semid, cookie, strerror(errno)); semid, cookie, strerror(errno));
return 0; return 0;
} }
log_debug_activation("Udev cookie 0x%" PRIx32 " (semid %d) incremented to %d", log_debug_activation("Udev cookie 0x%" PRIx32 " (semid %d) incremented to %d",
@ -2460,7 +2460,7 @@ static int _udev_notify_sem_dec(uint32_t cookie, int semid)
int val; int val;
if ((val = semctl(semid, 0, GETVAL)) < 0) { if ((val = semctl(semid, 0, GETVAL)) < 0) {
log_error("semid %d: sem_ctl GETVAL failed for " log_error("cookie dec: semid %d: sem_ctl GETVAL failed for "
"cookie 0x%" PRIx32 ": %s", "cookie 0x%" PRIx32 ": %s",
semid, cookie, strerror(errno)); semid, cookie, strerror(errno));
return 0; return 0;
@ -2469,13 +2469,13 @@ static int _udev_notify_sem_dec(uint32_t cookie, int semid)
if (semop(semid, &sb, 1) < 0) { if (semop(semid, &sb, 1) < 0) {
switch (errno) { switch (errno) {
case EAGAIN: case EAGAIN:
log_error("semid %d: semop failed for cookie " log_error("cookie dec: semid %d: semop failed for cookie "
"0x%" PRIx32 ": " "0x%" PRIx32 ": "
"incorrect semaphore state", "incorrect semaphore state",
semid, cookie); semid, cookie);
break; break;
default: default:
log_error("semid %d: semop failed for cookie " log_error("cookie dec: semid %d: semop failed for cookie "
"0x%" PRIx32 ": %s", "0x%" PRIx32 ": %s",
semid, cookie, strerror(errno)); semid, cookie, strerror(errno));
break; break;
@ -2562,7 +2562,7 @@ static int _udev_notify_sem_create(uint32_t *cookie, int *semid)
sem_arg.val = 1; sem_arg.val = 1;
if (semctl(gen_semid, 0, SETVAL, sem_arg) < 0) { if (semctl(gen_semid, 0, SETVAL, sem_arg) < 0) {
log_error("semid %d: semctl failed: %s", gen_semid, strerror(errno)); log_error("cookie create: semid %d: semctl failed: %s", gen_semid, strerror(errno));
/* We have to destroy just created semaphore /* We have to destroy just created semaphore
* so it won't stay in the system. */ * so it won't stay in the system. */
(void) _udev_notify_sem_destroy(gen_cookie, gen_semid); (void) _udev_notify_sem_destroy(gen_cookie, gen_semid);
@ -2570,7 +2570,7 @@ static int _udev_notify_sem_create(uint32_t *cookie, int *semid)
} }
if ((val = semctl(gen_semid, 0, GETVAL)) < 0) { if ((val = semctl(gen_semid, 0, GETVAL)) < 0) {
log_error("semid %d: sem_ctl GETVAL failed for " log_error("cookie create: semid %d: sem_ctl GETVAL failed for "
"cookie 0x%" PRIx32 ": %s", "cookie 0x%" PRIx32 ": %s",
gen_semid, gen_cookie, strerror(errno)); gen_semid, gen_cookie, strerror(errno));
goto bad; goto bad;