nginx-0.8.9
Igor Sysoev
is at rambler-co.ru
Thu Aug 20 17:54:17 MSD 2009
On Thu, Aug 20, 2009 at 01:34:23AM -0400, Jim Ohlstein wrote:
> 2009/08/20 00:50:42 [crit] 13580#0: *112240 rename()
> "/usr/local/nginx/fastcgi_temp/2/80/0000009802" to
> "/falcon/cache/f/f4/5a/7096031122aaf7e38913bec80d55af4f" failed (18:
> Invalid cross-device link) while reading upstream, client:
> 201.144.221.245, server: mydomain.com, request: "GET
> /rtwhtrsyrn/010110A/687474702s766964656s732q6772617469732r70657461726461732r636s6q2s702s31313633303561343266633632323761313136313463623030353665333635392s67616p7065742s67616p65726961732s333231342s7468756q62695s382r6n7067
> HTTP/1.1", upstream: "fastcgi://unix:/tmp/cgi.sock:", host: "mydomain.com",
> referrer:
> "https://mydomain.com/rtwhtrsyrn/010110A/687474702s67616p65726961732r70657461726461732r636s6q2s766q2s333231342s3230"
> No files are written to the cache but directories are created. If I add
> the following line to proper location blocks within the site config
> files which reference the cache:
>
> fastcgi_temp_path /falcon/fastcgi_temp;
>
> the the errors all go away and files are written to the cache.
>
> I'm not anxious to have temporary files being constantly written to the
> SSD as writes are still relatively slow and the lifespan of the devices,
> which are still fairly expensive, are affected by the number of writes
> if I understand correctly.
>
> What am I doing wrong?
Could test the attached patch ?
--
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/ngx_http_upstream.c
===================================================================
--- src/http/ngx_http_upstream.c (revision 2351)
+++ src/http/ngx_http_upstream.c (revision 2353)
@@ -2661,6 +2661,8 @@
}
}
+ path.len--;
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"upstream stores \"%s\" to \"%s\"",
tf->file.name.data, path.data);
Index: src/http/modules/ngx_http_dav_module.c
===================================================================
--- src/http/modules/ngx_http_dav_module.c (revision 2351)
+++ src/http/modules/ngx_http_dav_module.c (revision 2353)
@@ -214,6 +214,8 @@
ngx_http_map_uri_to_path(r, &path, &root, 0);
+ path.len--;
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http put filename: \"%s\"", path.data);
Index: src/core/ngx_file.c
===================================================================
--- src/core/ngx_file.c (revision 2351)
+++ src/core/ngx_file.c (revision 2353)
@@ -605,34 +605,43 @@
cf.time = ext->time;
cf.log = ext->log;
- name = ngx_alloc(to->len + 1 + 10, ext->log);
+ name = ngx_alloc(to->len + 1 + 10 + 1, ext->log);
if (name == NULL) {
return NGX_ERROR;
}
- (void) ngx_sprintf(name, "%*s.%010uD%Z", to->len - 1, to->data,
+ (void) ngx_sprintf(name, "%*s.%010uD%Z", to->len, to->data,
(uint32_t) ngx_next_temp_number(0));
if (ngx_copy_file(src->data, name, &cf) == NGX_OK) {
- if (ngx_rename_file(name, to->data) == NGX_FILE_ERROR) {
+ if (ngx_rename_file(name, to->data) != NGX_FILE_ERROR) {
ngx_free(name);
- goto failed;
+
+ if (ngx_delete_file(src->data) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_CRIT, ext->log, ngx_errno,
+ ngx_delete_file_n " \"%s\" failed",
+ src->data);
+ return NGX_ERROR;
+ }
+
+ return NGX_OK;
}
- ngx_free(name);
+ ngx_log_error(NGX_LOG_CRIT, ext->log, ngx_errno,
+ ngx_rename_file_n " \"%s\" to \"%s\" failed",
+ name, to->data);
- if (ngx_delete_file(src->data) == NGX_FILE_ERROR) {
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, ext->log, ngx_errno,
- ngx_delete_file_n " \"%s\" failed", src->data);
+ ngx_delete_file_n " \"%s\" failed", name);
- return NGX_ERROR;
}
-
- return NGX_OK;
}
ngx_free(name);
+
+ err = 0;
}
failed:
More information about the nginx
mailing list