diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2012-03-05 13:20:40 +0000 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-03-05 13:20:40 +0000 |
commit | 1b6a7864a1777b070851fead7626fb21862932b3 (patch) | |
tree | 4326f8cffcf6d4cafbde114ab8a35bd216203eb1 | |
parent | 0ffc4c3218a2a1ca45405754c86221d295d00dd1 (diff) | |
download | nginx-1b6a7864a1777b070851fead7626fb21862932b3.tar.gz |
Merge of r4499: workaround for fs_size on ZFS (ticket #46).
ZFS reports incorrect st_blocks until file settles on disk, and this
may take a while (i.e. just after creation of a file the st_blocks value
is incorrect). As a workaround we now use st_blocks only if
st_blocks * 512 > st_size, this should fix ZFS problems while still
preserving accuracy for other filesystems.
The problem had appeared in r3900 (1.0.1).
-rw-r--r-- | src/os/unix/ngx_files.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h index abeb1570b..12988245a 100644 --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h @@ -159,7 +159,7 @@ ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s); #define ngx_is_exec(sb) (((sb)->st_mode & S_IXUSR) == S_IXUSR) #define ngx_file_access(sb) ((sb)->st_mode & 0777) #define ngx_file_size(sb) (sb)->st_size -#define ngx_file_fs_size(sb) ((sb)->st_blocks * 512) +#define ngx_file_fs_size(sb) ngx_max((sb)->st_size, (sb)->st_blocks * 512) #define ngx_file_mtime(sb) (sb)->st_mtime #define ngx_file_uniq(sb) (sb)->st_ino @@ -255,7 +255,8 @@ ngx_de_info(u_char *name, ngx_dir_t *dir) #define ngx_de_access(dir) (((dir)->info.st_mode) & 0777) #define ngx_de_size(dir) (dir)->info.st_size -#define ngx_de_fs_size(dir) ((dir)->info.st_blocks * 512) +#define ngx_de_fs_size(dir) \ + ngx_max((dir)->info.st_size, (dir)->info.st_blocks * 512) #define ngx_de_mtime(dir) (dir)->info.st_mtime |