[nginx] Writing to some file systems can be interrupted.
Valentin Bartenev
vbart at nginx.com
Wed Sep 2 16:28:57 UTC 2015
details: http://hg.nginx.org/nginx/rev/6fce16b1fc10
branches:
changeset: 6240:6fce16b1fc10
user: Valentin Bartenev <vbart at nginx.com>
date: Wed Sep 02 19:26:40 2015 +0300
description:
Writing to some file systems can be interrupted.
At least such behavior was observed with CephFS, see:
http://mailman.nginx.org/pipermail/nginx/2015-July/048188.html.
diffstat:
src/os/unix/ngx_files.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diffs (33 lines):
diff -r 281863981d0b -r 6fce16b1fc10 src/os/unix/ngx_files.c
--- a/src/os/unix/ngx_files.c Mon Aug 31 23:26:33 2015 +0300
+++ b/src/os/unix/ngx_files.c Wed Sep 02 19:26:40 2015 +0300
@@ -264,6 +264,7 @@ ngx_write_chain_to_file(ngx_file_t *file
u_char *prev;
size_t size;
ssize_t total, n;
+ ngx_err_t err;
ngx_array_t vec;
struct iovec *iov, iovs[NGX_IOVS];
@@ -335,10 +336,20 @@ ngx_write_chain_to_file(ngx_file_t *file
file->sys_offset = offset;
}
+eintr:
+
n = writev(file->fd, vec.elts, vec.nelts);
if (n == -1) {
- ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
+ err = ngx_errno;
+
+ if (err == NGX_EINTR) {
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err,
+ "writev() was interrupted");
+ goto eintr;
+ }
+
+ ngx_log_error(NGX_LOG_CRIT, file->log, err,
"writev() \"%s\" failed", file->name.data);
return NGX_ERROR;
}
More information about the nginx-devel
mailing list