]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: file_wait_lock*(): Improve the panic log message on EDEADLOCK.
authorTimo Sirainen <tss@iki.fi>
Sat, 19 Sep 2015 22:04:50 +0000 (01:04 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 19 Sep 2015 22:04:50 +0000 (01:04 +0300)
src/lib/file-lock.c

index 1ccdbc692ab8c0b1d5f42705aa9e7f534949e3ad..82bcf261fe7691f5016f47095a4eb7d89a115b13 100644 (file)
@@ -211,6 +211,8 @@ static int file_lock_do(int fd, const char *path, int lock_type,
                }
                *error_r = t_strdup_printf("fcntl(%s, %s, %s) locking failed: %m",
                        path, lock_type_str, timeout_secs == 0 ? "F_SETLK" : "F_SETLKW");
+               if (errno == EDEADLOCK)
+                       i_panic("%s%s", *error_r, file_lock_find(fd, lock_method, lock_type));
                return -1;
 #endif
        }
@@ -257,6 +259,8 @@ static int file_lock_do(int fd, const char *path, int lock_type,
                }
                *error_r = t_strdup_printf("flock(%s, %s) failed: %m",
                                           path, lock_type_str);
+               if (errno == EDEADLOCK)
+                       i_panic("%s%s", *error_r, file_lock_find(fd, lock_method, lock_type));
                return -1;
 #endif
        }
@@ -292,10 +296,8 @@ int file_wait_lock_error(int fd, const char *path, int lock_type,
        int ret;
 
        ret = file_lock_do(fd, path, lock_type, lock_method, timeout_secs, error_r);
-       if (ret <= 0) {
-               i_assert(errno != EDEADLOCK);
+       if (ret <= 0)
                return ret;
-       }
 
        lock = i_new(struct file_lock, 1);
        lock->fd = fd;