Whamcloud - gitweb
LU-2655 obdclass: selinux support
[fs/lustre-release.git] / lustre / liblustre / tests / recovery_small.c
index 79e950b..8d0f255 100644 (file)
@@ -1,24 +1,39 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
+/*
+ * GPL HEADER START
  *
- * Lustre Light user test program
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
  *
- *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
- *   This file is part of Lustre, http://www.lustre.org.
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
  *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
  *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ * lustre/liblustre/tests/recovery_small.c
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Lustre Light user test program
  */
 
 #define _BSD_SOURCE
@@ -33,6 +48,7 @@
 #include <fcntl.h>
 #include <sys/queue.h>
 #include <getopt.h>
+#include <sys/wait.h>
 
 #include <sysio.h>
 #include <mount.h>
@@ -130,9 +146,10 @@ void cleanup_dir(const char *path)
         if (drop_arr[drop_index].name) {                                   \
             printf("server drops next %s\n", drop_arr[drop_index].name);   \
             sprintf(cmd,                                                   \
-                    "%s %s \"echo %lu > /proc/sys/lustre/fail_loc\"",      \
+                    "%s %s \"lctl set_param fail_loc=%lu\"",               \
                     ssh_cmd, mds_server, drop_arr[drop_index].code);       \
-            if ((rc = system(cmd))) {                                      \
+            if ((rc = system(cmd)) != 0) {                                 \
+                rc = WEXITSTATUS(rc);                                      \
                 printf("error excuting remote command: %d\n", rc);         \
                 exit(rc);                                                  \
             }                                                              \
@@ -144,9 +161,9 @@ void cleanup_dir(const char *path)
         char cmd[1024];                                                    \
                                                                            \
         if (drop_arr[drop_index].name) {                                   \
-            sprintf(cmd, "%s %s \"echo 0 > /proc/sys/lustre/fail_loc\"",   \
+            sprintf(cmd, "%s %s \"lctl set_param fail_loc=0\"",            \
                     ssh_cmd, mds_server);                                  \
-            system(cmd);                                                   \
+            if (!system(cmd)) {}                                           \
         }                                                                  \
     } while (0)