# HG changeset patch # User Maxim Dounin # Date 1719345477 -10800 # Node ID af5b47569cb265953df3920a343dfadfd153642c # Parent c5623963c29e2c8a79920b259d6884e024414f9d Core: fixed ENOSPC handling for error logs. For each connection a new ngx_log_t structure is created, and saving anything into disk_full_time field in this structure doesn't affect other connections. Fix is to move the disk_full_time field into the ngx_open_file_t structure. diff -r c5623963c29e -r af5b47569cb2 src/core/ngx_conf_file.c --- a/src/core/ngx_conf_file.c Tue Jun 25 21:44:50 2024 +0300 +++ b/src/core/ngx_conf_file.c Tue Jun 25 22:57:57 2024 +0300 @@ -951,6 +951,7 @@ file->name = *name; } + file->disk_full_time = 0; file->flush = NULL; file->data = NULL; diff -r c5623963c29e -r af5b47569cb2 src/core/ngx_conf_file.h --- a/src/core/ngx_conf_file.h Tue Jun 25 21:44:50 2024 +0300 +++ b/src/core/ngx_conf_file.h Tue Jun 25 22:57:57 2024 +0300 @@ -90,6 +90,8 @@ ngx_fd_t fd; ngx_str_t name; + time_t disk_full_time; + void (*flush)(ngx_open_file_t *file, ngx_log_t *log); void *data; }; diff -r c5623963c29e -r af5b47569cb2 src/core/ngx_log.c --- a/src/core/ngx_log.c Tue Jun 25 21:44:50 2024 +0300 +++ b/src/core/ngx_log.c Tue Jun 25 22:57:57 2024 +0300 @@ -169,7 +169,7 @@ goto next; } - if (ngx_time() == log->disk_full_time) { + if (ngx_time() == log->file->disk_full_time) { /* * on FreeBSD writing to a full filesystem with enabled softupdates @@ -183,7 +183,7 @@ n = ngx_write_fd(log->file->fd, errstr, p - errstr); if (n == -1 && ngx_errno == NGX_ENOSPC) { - log->disk_full_time = ngx_time(); + log->file->disk_full_time = ngx_time(); } if (log->file->fd == ngx_stderr) { diff -r c5623963c29e -r af5b47569cb2 src/core/ngx_log.h --- a/src/core/ngx_log.h Tue Jun 25 21:44:50 2024 +0300 +++ b/src/core/ngx_log.h Tue Jun 25 22:57:57 2024 +0300 @@ -53,8 +53,6 @@ ngx_atomic_uint_t connection; - time_t disk_full_time; - ngx_log_handler_pt handler; void *data;