diff --git a/lnet/include/libcfs/user-prim.h b/lnet/include/libcfs/user-prim.h
index 54f783217c61b625407982f8c231a1c27c0bd776..d182041995220c8377c5c3813e9fe6e0befb8bcc 100644
--- a/lnet/include/libcfs/user-prim.h
+++ b/lnet/include/libcfs/user-prim.h
@@ -46,6 +46,30 @@
 #include <libcfs/user-time.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <unistd.h>
+
+#ifndef PAGE_SIZE
+
+#define PAGE_SIZE (getpagesize())
+static __inline__ int getpageshift()
+{
+        int pagesize = getpagesize();
+#if (__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))
+        /* unsigned int is 32 bits on all our architectures */
+        return (__builtin_clz(pagesize) ^ 31);
+#else
+        register int pageshift = -1;
+        while (pagesize) { pagesize >>= 1; pageshift++; }
+        return pageshift;
+#endif
+}
+
+#undef  PAGE_MASK
+#define PAGE_MASK  (~(PAGE_SIZE-1))
+#undef  PAGE_SHIFT
+#define PAGE_SHIFT (getpageshift())
+
+#endif
 
 /*
  * Wait Queue. No-op implementation.
diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 51912f6325ea283efa93e6a30fca6446c58d657b..56e9438a4db91017ccfda5d6b0216a7c01c2f55a 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -168,6 +168,11 @@ Bugzilla   : 13039
 Description: RedHat Update kernel for RHEL5
 Details    : Modify the kernel config file more closer RHEL5.
 
+Severity   : normal
+Bugzilla   : 13360
+Description: Build failure against Centos5 (RHEL5)
+Details    : Define PAGE_SIZE when it isn't present.
+
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>