--- mdtest-1.8.3-orig/mdtest.c	2010-05-12 01:25:16.000000000 +0400
+++ mdtest-1.8.3/mdtest.c	2011-12-09 14:15:43.000000000 +0400
@@ -48,6 +48,7 @@
 #include <errno.h>
 #include <time.h>
 #include <sys/time.h>
+#include <attr/xattr.h>
 
 #define FILEMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH
 #define DIRMODE S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH
@@ -104,6 +105,8 @@ int write_bytes = 0;
 int sync_file = 0;
 int path_count = 0;
 int nstride = 0; /* neighbor stride */
+int g_xattr_size = 100;
+char *g_xattr = NULL;
 MPI_Comm testcomm;
 table_t * summary_table;
 
@@ -313,6 +316,11 @@ void create_remove_items_helper(int dirs
                         if ((fd = creat(curr_item, FILEMODE)) == -1) {
                             FAIL("unable to create file");
                         }
+                        if ( g_xattr )
+                                if ( fsetxattr(fd, "trusted.lov", g_xattr,
+                                               g_xattr_size, XATTR_CREATE) == -1){
+                                        FAIL("unable to create xatrr trusted.lov");
+                                }
                     }
                 }
 
@@ -564,6 +572,12 @@ void mdtest_stat(int random, int dirs) {
                 FAIL("unable to stat file");
             }
         }
+        if (!dirs && g_xattr) {
+                if (getxattr(item, "trusted.lov",
+                    g_xattr, g_xattr_size) == -1) {
+                    FAIL("unable to get xattr trusted.lov");
+                }
+        }
     }
 }
 
@@ -1378,7 +1392,7 @@ int main(int argc, char **argv) {
 
     /* Parse command line options */
     while (1) {
-        c = getopt(argc, argv, "b:BcCd:Df:Fhi:I:l:Ln:N:p:rR::s:StTuvV:w:yz:");
+        c = getopt(argc, argv, "b:BcCd:Df:Fhi:I:l:Ln:N:p:rR::s:StTuvV:w:x:yz:");
         if (c == -1) {
             break;
         }
@@ -1444,6 +1458,10 @@ int main(int argc, char **argv) {
                 verbose = atoi(optarg);       break;
             case 'w':
                 write_bytes = atoi(optarg);   break;
+            case 'x':
+                g_xattr_size = atoi(optarg);
+                g_xattr = alloca(g_xattr_size);
+                break;
             case 'y':
                 sync_file = 1;                break;
             case 'z':