summaryrefslogtreecommitdiff
path: root/src/bio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bio.c')
-rw-r--r--src/bio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bio.c b/src/bio.c
index 1a3e7a602..ff18c4fe7 100644
--- a/src/bio.c
+++ b/src/bio.c
@@ -220,10 +220,16 @@ void *bioProcessBackgroundJobs(void *arg) {
if (type == BIO_CLOSE_FILE) {
close(job->fd);
} else if (type == BIO_AOF_FSYNC) {
- if (redis_fsync(job->fd) == -1) {
+ /* The fd may be closed by main thread and reused for another
+ * socket, pipe, or file. We just ignore these errno because
+ * aof fsync did not really fail. */
+ if (redis_fsync(job->fd) == -1 &&
+ errno != EBADF && errno != EINVAL)
+ {
int last_status;
atomicGet(server.aof_bio_fsync_status,last_status);
atomicSet(server.aof_bio_fsync_status,C_ERR);
+ atomicSet(server.aof_bio_fsync_errno,errno);
if (last_status == C_OK) {
serverLog(LL_WARNING,
"Fail to fsync the AOF file: %s",strerror(errno));