trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject git commit: TS-2305: fall back to ftruncate on posix_fallocate failure
Date Wed, 22 Jan 2014 07:47:07 GMT
Updated Branches:
  refs/heads/4.1.x 39ba53d86 -> 2b9dd003b


TS-2305: fall back to ftruncate on posix_fallocate failure

Conflicts:
	CHANGES


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2b9dd003
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2b9dd003
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2b9dd003

Branch: refs/heads/4.1.x
Commit: 2b9dd003be8e520220d961fe8cc377e286ab3f25
Parents: 39ba53d
Author: James Peach <jpeach@apache.org>
Authored: Mon Jan 20 10:52:46 2014 -0800
Committer: Igor Galić <i.galic@brainsware.org>
Committed: Wed Jan 22 08:46:45 2014 +0100

----------------------------------------------------------------------
 CHANGES            |  2 ++
 lib/ts/ink_file.cc | 11 ++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2b9dd003/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 890db65..f45494c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.1.3
 
+  *) [TS-2305] Fall back to ftruncate if posix_fallocate fails.
+
   *) [TS-2497] Failed post results in tunnel buffers being returned to
    freelist prematurely.
    Reporter: Thomas Jackson <thjackso@linkedin.com>

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2b9dd003/lib/ts/ink_file.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_file.cc b/lib/ts/ink_file.cc
index 53d064f..41891f1 100644
--- a/lib/ts/ink_file.cc
+++ b/lib/ts/ink_file.cc
@@ -344,14 +344,19 @@ ink_file_fd_zerofill(int fd, off_t size)
     return errno;
   }
 
+  // ZFS does not implement posix_fallocate() and fails with EINVAL. As a general workaround,
+  // just fall back to ftrucate if the preallocation fails.
 #if HAVE_POSIX_FALLOCATE
-  return posix_fallocate(fd, 0, size);
-#else
+  if (posix_fallocate(fd, 0, size) == 0) {
+    return 0;
+  }
+#endif
+
   if (ftruncate(fd, size) < 0) {
     return errno;
   }
+
   return 0;
-#endif
 }
 
 bool


Mime
View raw message