Blame SOURCES/0005-tests-truncate-above-4GB-Skip-if-truncation-point-is.patch

fc9b0e
From 2a63852ac9358cdddce9944aade1d443f686246a Mon Sep 17 00:00:00 2001
fc9b0e
Message-Id: <2a63852ac9358cdddce9944aade1d443f686246a.1566225007.git.aquini@redhat.com>
fc9b0e
In-Reply-To: <d42f467a923dfc09309acb7a83b42e3285fbd8f4.1566225007.git.aquini@redhat.com>
fc9b0e
References: <d42f467a923dfc09309acb7a83b42e3285fbd8f4.1566225007.git.aquini@redhat.com>
fc9b0e
From: Sandipan Das <sandipan@linux.ibm.com>
fc9b0e
Date: Thu, 15 Aug 2019 13:08:32 +0530
fc9b0e
Subject: [RHEL7 PATCH 05/31] tests: truncate-above-4GB: Skip if truncation
fc9b0e
 point is not aligned
fc9b0e
fc9b0e
Attempting ftruncate() on a hugetlbfs file descriptor requires
fc9b0e
the truncation point to be aligned to the huge page size. So,
fc9b0e
this test is not applicable for huge page sizes greater that
fc9b0e
are either greater than or not a factor of the truncation point.
fc9b0e
fc9b0e
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
fc9b0e
Signed-off-by: Eric B Munson <emunson@mgebm.net>
fc9b0e
Signed-off-by: Rafael Aquini <aquini@redhat.com>
fc9b0e
---
fc9b0e
 tests/truncate_above_4GB.c | 8 +++++++-
fc9b0e
 1 file changed, 7 insertions(+), 1 deletion(-)
fc9b0e
fc9b0e
diff --git a/tests/truncate_above_4GB.c b/tests/truncate_above_4GB.c
fc9b0e
index 4c427fc..2e29931 100644
fc9b0e
--- a/tests/truncate_above_4GB.c
fc9b0e
+++ b/tests/truncate_above_4GB.c
fc9b0e
@@ -79,6 +79,13 @@ int main(int argc, char *argv[])
fc9b0e
 
fc9b0e
 	page_size = getpagesize();
fc9b0e
 	hpage_size = check_hugepagesize();
fc9b0e
+	truncate_point = FOURGIG;
fc9b0e
+
fc9b0e
+	if (hpage_size > truncate_point)
fc9b0e
+		CONFIG("Huge page size is too large");
fc9b0e
+
fc9b0e
+	if (truncate_point % hpage_size > 0)
fc9b0e
+		CONFIG("Truncation point is not aligned to huge page size");
fc9b0e
 
fc9b0e
 	check_free_huge_pages(3);
fc9b0e
 
fc9b0e
@@ -86,7 +93,6 @@ int main(int argc, char *argv[])
fc9b0e
 	if (fd < 0)
fc9b0e
 		FAIL("hugetlbfs_unlinked_fd()");
fc9b0e
 
fc9b0e
-	truncate_point = FOURGIG;
fc9b0e
 	buggy_offset = truncate_point / (hpage_size / page_size);
fc9b0e
 	buggy_offset = ALIGN(buggy_offset, hpage_size);
fc9b0e
 
fc9b0e
-- 
fc9b0e
1.8.3.1
fc9b0e