diff --git a/build/Rules.in b/build/Rules.in
index f03bb806d3efb2787e586ffadea8fdce179e1ea8..815b3da57c29ede9192619685191129efdeac3d2 100644
--- a/build/Rules.in
+++ b/build/Rules.in
@@ -60,7 +60,7 @@ else
 include @LINUX_CONFIG@
 
 EXTRA_CFLAGS := $(EXTRA_PRE_CFLAGS)
-EXTRA_CFLAGS += @EXTRA_KCFLAGS@ @UML_CFLAGS@
+EXTRA_CFLAGS += @EXTRA_KCFLAGS@ @UML_CFLAGS@ @CFLAGS@
 EXTRA_CFLAGS += $(EXTRA_POST_CFLAGS)
 
 obj-m := $(patsubst %,%.o,$(MODULES))
diff --git a/build/autoconf/lustre-build.m4 b/build/autoconf/lustre-build.m4
index cbc76bbf83e0a1f37cd992ba6af4d14220168075..42b20b915ef545415098a2e045b4f82bcab43979 100644
--- a/build/autoconf/lustre-build.m4
+++ b/build/autoconf/lustre-build.m4
@@ -452,6 +452,7 @@ AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
+AM_CONDITIONAL(CRAY_XT3, test x$enable_cray_xt3 = "xyes")
 
 # this lets lustre cancel libsysio, per-branch or if liblustre is
 # disabled
diff --git a/lustre/include/linux/lustre_user.h b/lustre/include/linux/lustre_user.h
index a549214259c458c1508040191c0e72bbee33a6ea..477899329992507309ce9cebac9009dd7bd8a61b 100644
--- a/lustre/include/linux/lustre_user.h
+++ b/lustre/include/linux/lustre_user.h
@@ -57,26 +57,35 @@ typedef struct stat64   lstat_t;
 #endif
 
 #ifndef LPU64
+/* this is a bit chunky */
+#if defined(__KERNEL__)
+ #define _LWORDSIZE BITS_PER_LONG
+#else
+ #define _LWORDSIZE __WORDSIZE
+#endif
 /* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
-#if defined(__x86_64__) && defined(__KERNEL__)
+#if (defined(__x86_64__) && (defined(__KERNEL__) || defined(CRAY_XT3)))
 # define LPU64 "%Lu"
 # define LPD64 "%Ld"
 # define LPX64 "%#Lx"
 # define LPSZ  "%lu"
 # define LPSSZ "%ld"
-#elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
+#elif (_LWORDSIZE == 32)
 # define LPU64 "%Lu"
 # define LPD64 "%Ld"
 # define LPX64 "%#Lx"
 # define LPSZ  "%u"
 # define LPSSZ "%d"
-#elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
+#elif (_LWORDSIZE == 64)
 # define LPU64 "%lu"
 # define LPD64 "%ld"
 # define LPX64 "%#lx"
 # define LPSZ  "%lu"
 # define LPSSZ "%ld"
 #endif
+
+#undef _LWORDSIZE
+
 #endif /* !LPU64 */
 
 #endif /* _LUSTRE_USER_H */
diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h
index 4f4aa86b40a213aecac4c56f27242594be906b7f..451d16cbeb50fd547df10c5cbf13a0e7e8b17605 100644
--- a/lustre/include/lustre_lib.h
+++ b/lustre/include/lustre_lib.h
@@ -120,47 +120,47 @@ int l_has_lock(struct lustre_lock *);
 #define OBD_IOCTL_VERSION 0x00010004
 
 struct obd_ioctl_data {
-        uint32_t ioc_len;
-        uint32_t ioc_version;
+        __u32 ioc_len;
+        __u32 ioc_version;
 
-        uint64_t ioc_cookie;
-        uint32_t ioc_conn1;
-        uint32_t ioc_conn2;
+        __u64 ioc_cookie;
+        __u32 ioc_conn1;
+        __u32 ioc_conn2;
 
         struct obdo ioc_obdo1;
         struct obdo ioc_obdo2;
 
         obd_size         ioc_count;
         obd_off          ioc_offset;
-        uint32_t         ioc_dev;
-        uint32_t         ioc_command;
+        __u32            ioc_dev;
+        __u32            ioc_command;
 
-        uint64_t ioc_nid;
-        uint32_t ioc_nal;
-        uint32_t ioc_type;
+        __u64 ioc_nid;
+        __u32 ioc_nal;
+        __u32 ioc_type;
 
         /* buffers the kernel will treat as user pointers */
-        uint32_t ioc_plen1;
+        __u32    ioc_plen1;
         char    *ioc_pbuf1;
-        uint32_t ioc_plen2;
+        __u32    ioc_plen2;
         char    *ioc_pbuf2;
 
         /* inline buffers for various arguments */
-        uint32_t ioc_inllen1;
+        __u32    ioc_inllen1;
         char    *ioc_inlbuf1;
-        uint32_t ioc_inllen2;
+        __u32    ioc_inllen2;
         char    *ioc_inlbuf2;
-        uint32_t ioc_inllen3;
+        __u32    ioc_inllen3;
         char    *ioc_inlbuf3;
-        uint32_t ioc_inllen4;
+        __u32    ioc_inllen4;
         char    *ioc_inlbuf4;
 
         char    ioc_bulk[0];
 };
 
 struct obd_ioctl_hdr {
-        uint32_t ioc_len;
-        uint32_t ioc_version;
+        __u32    ioc_len;
+        __u32    ioc_version;
 };
 
 static inline int obd_ioctl_packlen(struct obd_ioctl_data *data)
diff --git a/lustre/liblustre/llite_lib.c b/lustre/liblustre/llite_lib.c
index 8adbb455fcc56eb4b8facde8eafe2bdd6ee526fc..6f0c57037a2362ac5432b1aeaad9ef1221b29fd9 100644
--- a/lustre/liblustre/llite_lib.c
+++ b/lustre/liblustre/llite_lib.c
@@ -307,9 +307,7 @@ char *lustre_path = NULL;
 void __liblustre_setup_(void)
 {
         char *target = NULL;
-        char *root_driver = "native";
         char *lustre_driver = "lustre";
-        char *root_path = "/";
         unsigned mntflgs = 0;
         int err;
 
@@ -336,7 +334,7 @@ void __liblustre_setup_(void)
         }
         _sysio_native_init();
 
-        err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL);
+        err = _sysio_mount_root("/", "native", mntflgs, NULL);
         if (err) {
                 fprintf(stderr, "sysio mount failed: %s\n", strerror(errno));
                 exit(1);
diff --git a/lustre/liblustre/lutil.c b/lustre/liblustre/lutil.c
index b4689d517ae14b7e724d3f5a731756f3dd9a42f0..db203f37678210720e6f8068ae7626f5bd8ae38d 100644
--- a/lustre/liblustre/lutil.c
+++ b/lustre/liblustre/lutil.c
@@ -104,11 +104,11 @@ static int get_ipv4_addr()
 
 void liblustre_init_random()
 {
-        int _rand_dev_fd;
         int seed[2];
         struct timeval tv;
 
 #ifdef LIBLUSTRE_USE_URANDOM
+        int _rand_dev_fd;
         _rand_dev_fd = syscall(SYS_open, "/dev/urandom", O_RDONLY);
         if (_rand_dev_fd >= 0) {
                 if (syscall(SYS_read, _rand_dev_fd,
diff --git a/lustre/liblustre/tests/Makefile.am b/lustre/liblustre/tests/Makefile.am
index 9ed59aa0b5149b01bf25fd5536b9720f0378227f..75943ff548c98607a53c1daafecaf7f095a1e6a1 100644
--- a/lustre/liblustre/tests/Makefile.am
+++ b/lustre/liblustre/tests/Makefile.am
@@ -10,7 +10,11 @@ if LIBLUSTRE
 noinst_LIBRARIES = libtestcommon.a
 
 if LIBLUSTRE_TESTS
-noinst_PROGRAMS = sanity recovery_small replay_single replay_ost_single echo_test
+noinst_PROGRAMS = sanity echo_test
+
+if !CRAY_XT3
+noinst_PROGRAMS += recovery_small replay_single replay_ost_single
+endif # !CRAY_XT3
 
 if MPITESTS
 noinst_PROGRAMS += test_lock_cancel
diff --git a/lustre/liblustre/tests/sanity.c b/lustre/liblustre/tests/sanity.c
index 9edfc9264368d5aa0c96bc2942f7b3b5c9c91377..16014bc055d5579e65be395c135c0c5ff05b0f61 100644
--- a/lustre/liblustre/tests/sanity.c
+++ b/lustre/liblustre/tests/sanity.c
@@ -38,10 +38,12 @@
 #include <dirent.h>
 #include <sys/uio.h>
 #include <sys/time.h>
+#include <time.h>
+#include <sys/ioctl.h>
 
 #include "test_common.h"
 #include <ioctl.h>
-#include <lustre/lustre_user.h>
+#include <lustre/liblustreapi.h>
 
 #ifndef PAGE_SIZE
 #define PAGE_SIZE getpagesize()
@@ -522,8 +524,7 @@ int t18(char *name)
 int t18b(char *name)
 {
         char file[MAX_PATH_LENGTH] = "";
-        char buf[128];
-        int fd, i;
+        int i;
         struct stat statbuf[3];
         ENTRY("utime should change mtime/atime/ctime");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t18b_file", lustre_path);
@@ -562,7 +563,7 @@ static int check_file_size(char *file, off_t size)
                 return(1);
         }
         if (statbuf.st_size != size) {
-                printf("size of %s: %ld != %ld\n", file, statbuf.st_size, size);
+                printf("size of %s: %ld != %lld\n", file, statbuf.st_size, size);
                 return(-1);
         }
         return 0;
@@ -685,7 +686,7 @@ int t21(char *name)
 
         fd = open(file, O_RDWR|O_CREAT, (mode_t)0666);
         if (fd < 0) {
-                printf("error open file: %m\n", file);
+                printf("error open file: %s\n", file);
                 return(-1);
         }
 
@@ -1243,7 +1244,7 @@ int t55(char *name)
                         printf("object %d:\n", index);
                         printf("\tobject_gr:    "LPX64"\n", lo->l_object_gr);
                         printf("\tobject_id:    "LPX64"\n", lo->l_object_id);
-                        printf("\tost_gen:      "LPX64"\n", lo->l_ost_gen);
+                        printf("\tost_gen:      %#x\n", lo->l_ost_gen);
                         printf("\tost_idx:      %u\n", lo->l_ost_idx);
                 }
         }
@@ -1309,7 +1310,7 @@ int t55(char *name)
                         printf("object %d:\n", index);
                         printf("\tobject_gr:    "LPX64"\n", lo->l_object_gr);
                         printf("\tobject_id:    "LPX64"\n", lo->l_object_id);
-                        printf("\tost_gen:      "LPX64"\n", lo->l_ost_gen);
+                        printf("\tost_gen:      %#x\n", lo->l_ost_gen);
                         printf("\tost_idx:      %u\n", lo->l_ost_idx);
                 }
         }
diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index b6ba695f45d1749431b7c171368e47df694d1610..a4778660c18fa6aaedd54fb9f39d685f71ff3184 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -1917,7 +1917,7 @@ int ll_obd_statfs(struct inode *inode, void *arg)
         char *buf = NULL;
         struct obd_ioctl_data *data = NULL;
         __u32 type, index;
-        int len, rc;
+        int len = 0, rc;
 
         if (!inode || !(sbi = ll_i2sbi(inode)))
                 GOTO(out_statfs, rc = -EINVAL);
diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c
index c2af448229cd95ea4318fddc0a48ecede7c37d27..ccf80f3d8fa9838cf4207b3563bafeb56966436f 100644
--- a/lustre/obdclass/class_obd.c
+++ b/lustre/obdclass/class_obd.c
@@ -116,7 +116,7 @@ static inline void obd_conn2data(struct obd_ioctl_data *data,
         data->ioc_cookie = conn->cookie;
 }
 
-int class_resolve_dev_name(uint32_t len, const char *name)
+int class_resolve_dev_name(__u32 len, const char *name)
 {
         int rc;
         int dev;
diff --git a/lustre/tests/test_brw.c b/lustre/tests/test_brw.c
index dd94d1bb860fea46e5719a35a2ac85baf107c14c..d225b473f0d2e2db16d0c94b39799a845cf9826d 100644
--- a/lustre/tests/test_brw.c
+++ b/lustre/tests/test_brw.c
@@ -152,7 +152,7 @@ int main(int argc, char **argv)
                 objid = 3;
         }
 
-        printf("%s: %s on %s(objid "LPX64") for "LPU64"x%ld pages \n",
+        printf("%s: %s on %s(objid "LPX64") for "LPSZ"x%ld pages \n",
                argv[0], 
 #ifdef O_DIRECT
                flags & O_DIRECT ? "directio" : "i/o",
diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c
index 2917a40a6827336f1c0817837abc05f687a7e3e1..fdd18cf519a69bc0fbec1914a545cd76033f7ac9 100644
--- a/lustre/utils/obd.c
+++ b/lustre/utils/obd.c
@@ -2062,5 +2062,6 @@ void obd_finalize(int argc, char **argv)
         sigact.sa_flags = SA_RESTART;
         sigaction(SIGINT, &sigact, NULL);
 
+        shmem_stop();
         do_disconnect(argv[0], 1);
 }
diff --git a/lustre/utils/obdbarrier.c b/lustre/utils/obdbarrier.c
index 8774cef0407c2c797c0c92cce3d961874b9d94da..f2c6eb1f94c98bc22c3e18fa91fc828ff1373265 100644
--- a/lustre/utils/obdbarrier.c
+++ b/lustre/utils/obdbarrier.c
@@ -30,9 +30,9 @@
 #include "obdiolib.h"
 
 int
-parse_kmg (uint64_t *valp, char *str)
+parse_kmg (__u64 *valp, char *str)
 {
-        uint64_t        val;
+        __u64        val;
         char            mod[32];
 
         switch (sscanf (str, LPU64"%1[gGmMkK]", &val, mod))
@@ -100,9 +100,9 @@ exponential_modulus (int i, int base)
 int
 main (int argc, char **argv)
 {
-        uint64_t              bid = (((uint64_t)gethostid()) << 32) | getpid ();
+        __u64                 bid = (((__u64)gethostid()) << 32) | getpid ();
         int                   set_bid = 0;
-        uint64_t              oid;
+        __u64                 oid;
         int                   setup = 0;
         int                   device = -1;
         int                   npeers = 0;
@@ -111,7 +111,7 @@ main (int argc, char **argv)
         struct obdio_conn    *conn;
         struct obdio_barrier *b;
         char                 *end;
-        uint64_t              val;
+        __u64                 val;
         int                   rc;
         int                   c;
 
diff --git a/lustre/utils/obdio.c b/lustre/utils/obdio.c
index 0152064a1d1929b9b0cf3e7d4119b198831f449b..a8a6a73846add21c21e24c906ddcdaf46a920b44 100644
--- a/lustre/utils/obdio.c
+++ b/lustre/utils/obdio.c
@@ -31,14 +31,14 @@
 
 int
 obdio_test_fixed_extent (struct obdio_conn *conn,
-                         uint32_t myhid, uint32_t mypid,
-                         int reps, int locked, uint64_t oid,
-                         uint64_t offset, uint32_t size)
+                         __u32 myhid, __u32 mypid,
+                         int reps, int locked, __u64 oid,
+                         __u64 offset, __u32 size)
 {
         struct lustre_handle lh;
         void                *space;
         void                *buffer;
-        uint32_t            *ibuf;
+        __u32               *ibuf;
         int                  i;
         int                  j;
         int                  rc = 0;
@@ -50,7 +50,7 @@ obdio_test_fixed_extent (struct obdio_conn *conn,
         }
 
         for (i = 0; i < reps; i++) {
-                ibuf = (uint32_t *) buffer;
+                ibuf = (__u32 *) buffer;
                 for (j = 0; j < size / (4 * sizeof (*ibuf)); j++) {
                         ibuf[0] = myhid;
                         ibuf[1] = mypid;
@@ -104,7 +104,7 @@ obdio_test_fixed_extent (struct obdio_conn *conn,
                         }
                 }
 
-                ibuf = (uint32_t *) buffer;
+                ibuf = (__u32 *) buffer;
                 for (j = 0; j < size / (4 * sizeof (*ibuf)); j++) {
                         if (ibuf[0] != myhid ||
                             ibuf[1] != mypid ||
@@ -129,9 +129,9 @@ obdio_test_fixed_extent (struct obdio_conn *conn,
 }
 
 int
-parse_kmg (uint64_t *valp, char *str)
+parse_kmg (__u64 *valp, char *str)
 {
-        uint64_t        val;
+        __u64           val;
         char            mod[32];
 
         switch (sscanf (str, LPU64"%1[gGmMkK]", &val, mod))
@@ -184,18 +184,18 @@ usage (char *cmdname, int help)
 int
 main (int argc, char **argv)
 {
-        uint32_t           mypid = getpid ();
-        uint32_t           myhid = gethostid ();
-        uint64_t           oid;
-        uint64_t           base_offset = 0;
-        uint32_t           size = 0;
+        __u32             mypid = getpid ();
+        __u32             myhid = gethostid ();
+        __u64             oid;
+        __u64             base_offset = 0;
+        __u32             size = 0;
         int                set_size = 0;
         int                device = -1;
         int                reps = 1;
         int                locked = 0;
         char              *end;
         struct obdio_conn *conn;
-        uint64_t           val;
+        __u64              val;
         int                v1;
         int                v2;
         int                rc;
@@ -229,7 +229,7 @@ main (int argc, char **argv)
                                          optarg);
                                 return (1);
                         }
-                        size = (uint32_t)val;
+                        size = (__u32)val;
                         set_size++;
                         break;
 
diff --git a/lustre/utils/obdiolib.c b/lustre/utils/obdiolib.c
index c4021045e8a9e20b5d4803ca7290889fa0a690a9..9e046e27a9c5600eb624e318740ba25783716786 100644
--- a/lustre/utils/obdiolib.c
+++ b/lustre/utils/obdiolib.c
@@ -106,8 +106,8 @@ obdio_disconnect (struct obdio_conn *conn, int flags)
 }
 
 int
-obdio_pread (struct obdio_conn *conn, uint64_t oid,
-             void *buffer, uint32_t count, uint64_t offset)
+obdio_pread (struct obdio_conn *conn, __u64 oid,
+             void *buffer, __u32 count, __u64 offset)
 {
         obdio_iocinit (conn);
 
@@ -125,8 +125,8 @@ obdio_pread (struct obdio_conn *conn, uint64_t oid,
 }
 
 int
-obdio_pwrite (struct obdio_conn *conn, uint64_t oid,
-              void *buffer, uint32_t count, uint64_t offset)
+obdio_pwrite (struct obdio_conn *conn, __u64 oid,
+              void *buffer, __u32 count, __u64 offset)
 {
         obdio_iocinit (conn);
 
@@ -144,8 +144,8 @@ obdio_pwrite (struct obdio_conn *conn, uint64_t oid,
 }
 
 int
-obdio_enqueue (struct obdio_conn *conn, uint64_t oid,
-               int mode, uint64_t offset, uint32_t count,
+obdio_enqueue (struct obdio_conn *conn, __u64 oid,
+               int mode, __u64 offset, __u32 count,
                struct lustre_handle *lh)
 {
         int   rc;
@@ -193,7 +193,7 @@ obdio_alloc_aligned_buffer (void **spacep, int size)
 }
 
 struct obdio_barrier *
-obdio_new_barrier (uint64_t oid, uint64_t id, int npeers)
+obdio_new_barrier (__u64 oid, __u64 id, int npeers)
 {
         struct obdio_barrier *b;
 
diff --git a/lustre/utils/obdiolib.h b/lustre/utils/obdiolib.h
index 97be436e5687fe53341b8ed50043adf13e2660e4..e9e0642d0b1776f013130652afb0794703edfa14 100644
--- a/lustre/utils/obdiolib.h
+++ b/lustre/utils/obdiolib.h
@@ -17,35 +17,35 @@
 
 struct obdio_conn {
         int                    oc_fd;
-        uint32_t               oc_device;
+        __u32                  oc_device;
         struct obd_ioctl_data  oc_data;
         char                   oc_buffer[8192];
 };
 
 struct obdio_barrier {
-        uint64_t               ob_id;
-        uint64_t               ob_oid;
-        uint64_t               ob_npeers;
-        uint64_t               ob_ordinal;
-        uint64_t               ob_count;
+        __u64                  ob_id;
+        __u64                  ob_oid;
+        __u64                  ob_npeers;
+        __u64                  ob_ordinal;
+        __u64                  ob_count;
 };
 
 extern struct obdio_conn *obdio_connect(int device);
 extern void obdio_disconnect(struct obdio_conn *conn, int flags);
-extern int obdio_open(struct obdio_conn *conn, uint64_t oid,
+extern int obdio_open(struct obdio_conn *conn, __u64 oid,
                       struct lustre_handle *fh);
-extern int obdio_close(struct obdio_conn *conn, uint64_t oid,
+extern int obdio_close(struct obdio_conn *conn, __u64 oid,
                        struct lustre_handle *fh);
-extern int obdio_pread(struct obdio_conn *conn, uint64_t oid,
-                       void *buffer, uint32_t count, uint64_t offset);
-extern int obdio_pwrite(struct obdio_conn *conn, uint64_t oid,
-                        void *buffer, uint32_t count, uint64_t offset);
-extern int obdio_enqueue(struct obdio_conn *conn, uint64_t oid,
-                         int mode, uint64_t offset, uint32_t count,
+extern int obdio_pread(struct obdio_conn *conn, __u64 oid,
+                       void *buffer, __u32 count, __u64 offset);
+extern int obdio_pwrite(struct obdio_conn *conn, __u64 oid,
+                        void *buffer, __u32 count, __u64 offset);
+extern int obdio_enqueue(struct obdio_conn *conn, __u64 oid,
+                         int mode, __u64 offset, __u32 count,
                          struct lustre_handle *lh);
 extern int obdio_cancel(struct obdio_conn *conn, struct lustre_handle *lh);
 extern void *obdio_alloc_aligned_buffer(void **spacep, int size);
-extern struct obdio_barrier *obdio_new_barrier(uint64_t oid, uint64_t id,
+extern struct obdio_barrier *obdio_new_barrier(__u64 oid, __u64 id,
                                                int npeers);
 extern int obdio_setup_barrier(struct obdio_conn *conn,struct obdio_barrier *b);
 extern int obdio_barrier(struct obdio_conn *conn, struct obdio_barrier *b);