Whamcloud - gitweb
LU-2665 mdc: Keep resend FLocks
[fs/lustre-release.git] / libcfs / libcfs / darwin / darwin-proc.c
index a001f5b..b1e2e84 100644 (file)
@@ -1,22 +1,35 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
+ * 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 file is part of Lustre, http://www.lustre.org.
+ * 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).
  *
- *   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.
+ * 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
  *
- *   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.
+ * 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.
  *
- *   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.
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2008, 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.
  */
 
 #include <sys/param.h>
@@ -129,6 +142,25 @@ static int sysctl_debug_mb SYSCTL_HANDLER_ARGS
        return error;
 }
 
+static int proc_fail_loc SYSCTL_HANDLER_ARGS
+{
+        int error = 0;
+        long old_fail_loc = cfs_fail_loc;
+
+        error = sysctl_handle_long(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
+        if (!error && req->newptr != USER_ADDR_NULL) {
+                if (old_fail_loc != cfs_fail_loc)
+                        cfs_waitq_signal(&cfs_race_waitq);
+        } else  if (req->newptr != USER_ADDR_NULL) {
+                /* Something was wrong with the write request */
+                printf ("sysctl fail loc fault: %d.\n", error);
+        } else {
+                /* Read request */
+                error = SYSCTL_OUT(req, &cfs_fail_loc, sizeof cfs_fail_loc);
+        }
+        return error;
+}
+
 /*
  * sysctl table for lnet
  */
@@ -168,7 +200,9 @@ SYSCTL_PROC(_lnet,                  OID_AUTO,       daemon_file,
 SYSCTL_PROC(_lnet,                     OID_AUTO,       debug_mb,
             CTLTYPE_INT | CTLFLAG_RW,                  0,
             0,         &sysctl_debug_mb,               "L",    "debug_mb");
-
+SYSCTL_PROC(_lnet,                      OID_AUTO,       fail_loc, 
+             CTLTYPE_INT | CTLFLAG_RW ,                 &cfs_fail_loc,
+             0,         &proc_fail_loc,                 "I",    "cfs_fail_loc");
 
 static cfs_sysctl_table_t      top_table[] = {
        &sysctl__lnet,
@@ -182,6 +216,7 @@ static cfs_sysctl_table_t   top_table[] = {
        &sysctl__lnet_debug_kernel,
        &sysctl__lnet_daemon_file,
        &sysctl__lnet_debug_mb,
+        &sysctl__lnet_cfs_fail_loc
        NULL
 };
 
@@ -464,4 +499,3 @@ cfs_sysctl_fini(void)
         libcfs_sysctl_sprite.ss_magic = 0;
         libcfs_sysctl_sprite.ss_link = NULL;
 }
-