gracefully handle full /tmp file system
[fio.git] / mutex.c
diff --git a/mutex.c b/mutex.c
index abe073f4ffdf7d49ee92500db8d89e254def2852..88044f3a818753feb374bc0370e545fb2095d248 100644 (file)
--- a/mutex.c
+++ b/mutex.c
@@ -33,6 +33,14 @@ struct fio_mutex *fio_mutex_init(int value)
                return NULL;
        }
 
                return NULL;
        }
 
+#ifdef FIO_HAVE_FALLOCATE
+       ret = posix_fallocate(fd, 0, sizeof(struct fio_mutex));
+       if (ret > 0) {
+               fprintf(stderr, "posix_fallocate mutex failed: %s\n", strerror(ret));
+               goto err;
+       }
+#endif
+
        if (ftruncate(fd, sizeof(struct fio_mutex)) < 0) {
                perror("ftruncate mutex");
                goto err;
        if (ftruncate(fd, sizeof(struct fio_mutex)) < 0) {
                perror("ftruncate mutex");
                goto err;