diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-09-30 13:57:44 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2011-09-30 13:57:44 +0000 |
commit | 66ef8eba590ab96429356650297e173f41396eff (patch) | |
tree | 6d21815f4ed1dac2103f9170ecd72f1bb12b26a8 | |
parent | 86553d2e0a955c97846e621fb62a4d3550982ab1 (diff) | |
download | nginx-66ef8eba590ab96429356650297e173f41396eff.tar.gz nginx-66ef8eba590ab96429356650297e173f41396eff.zip |
Merging r4077, r4101, r4102:
open_file_cache related fixes:
*) Bugfix: open_file_cache lost is_directio flag.
On file retest open_file_cache lost is_directio if file wasn't changed.
This caused unaligned operations under Linux to fail with EINVAL.
It wasn't noticeable with AIO though, as errors wasn't properly logged.
*) Bugfix: open_file_cache did not update file info on retest.
If file inode was not changed, cached file information was not updated
on retest. As a result stale information might be cached forever if file
attributes was changed and/or file was extended.
-rw-r--r-- | src/core/ngx_open_file_cache.c | 8 | ||||
-rw-r--r-- | src/os/unix/ngx_file_aio_read.c | 3 | ||||
-rw-r--r-- | src/os/unix/ngx_linux_aio_read.c | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c index a70385c35..0d605b527 100644 --- a/src/core/ngx_open_file_cache.c +++ b/src/core/ngx_open_file_cache.c @@ -284,13 +284,13 @@ ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name, if (of->uniq == file->uniq) { - file->count++; - if (file->event) { file->use_event = 1; } - goto renew; + of->is_directio = file->is_directio; + + goto update; } /* file was changed */ @@ -394,8 +394,6 @@ update: } } -renew: - file->created = now; found: diff --git a/src/os/unix/ngx_file_aio_read.c b/src/os/unix/ngx_file_aio_read.c index ef7a46107..557f9de6a 100644 --- a/src/os/unix/ngx_file_aio_read.c +++ b/src/os/unix/ngx_file_aio_read.c @@ -86,6 +86,9 @@ ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset, return aio->nbytes; } + ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, + "aio read \"%s\" failed", file->name.data); + return NGX_ERROR; } diff --git a/src/os/unix/ngx_linux_aio_read.c b/src/os/unix/ngx_linux_aio_read.c index 72875ca01..b9d1d01cd 100644 --- a/src/os/unix/ngx_linux_aio_read.c +++ b/src/os/unix/ngx_linux_aio_read.c @@ -74,6 +74,10 @@ ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset, } ngx_set_errno(-aio->res); + + ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, + "aio read \"%s\" failed", file->name.data); + return NGX_ERROR; } |