X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=libcfs%2Flibcfs%2Ffail.c;h=12addb20803f34b88e76cbc4ba0a28c9b6aad7a0;hb=a8dcf372f430c308d3e96fb506563068d0a80c2d;hp=3d1d3a0a5d3a7c10a3d02ddc4c208e4ef51d8755;hpb=381604c5c45c7f7394185f434bb8ad1dd4ed88af;p=fs%2Flustre-release.git diff --git a/libcfs/libcfs/fail.c b/libcfs/libcfs/fail.c index 3d1d3a0..12addb2 100644 --- a/libcfs/libcfs/fail.c +++ b/libcfs/libcfs/fail.c @@ -16,36 +16,30 @@ * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see http://www.gnu.org/licenses * - * Please contact Oracle Corporation, Inc., 500 Oracle Parkway, Redwood Shores, - * CA 94065 USA or visit www.oracle.com if you need additional information or - * have any questions. - * * GPL HEADER END */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Oracle Corporation, Inc. */ -#ifndef __KERNEL__ -#include -#else #include -#endif unsigned long cfs_fail_loc = 0; unsigned int cfs_fail_val = 0; -wait_queue_head_t cfs_race_waitq; +int cfs_fail_err; +DECLARE_WAIT_QUEUE_HEAD(cfs_race_waitq); int cfs_race_state; EXPORT_SYMBOL(cfs_fail_loc); EXPORT_SYMBOL(cfs_fail_val); +EXPORT_SYMBOL(cfs_fail_err); EXPORT_SYMBOL(cfs_race_waitq); EXPORT_SYMBOL(cfs_race_state); @@ -114,6 +108,7 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set) break; case CFS_FAIL_LOC_RESET: cfs_fail_loc = value; + atomic_set(&cfs_fail_count, 0); break; default: LASSERTF(0, "called with bad set %u\n", set); @@ -129,11 +124,11 @@ int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set) int ret = 0; ret = __cfs_fail_check_set(id, value, set); - if (ret) { + if (ret && likely(ms > 0)) { CERROR("cfs_fail_timeout id %x sleeping for %dms\n", id, ms); - schedule_timeout_and_set_state(TASK_UNINTERRUPTIBLE, - cfs_time_seconds(ms) / 1000); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(cfs_time_seconds(ms) / 1000); set_current_state(TASK_RUNNING); CERROR("cfs_fail_timeout id %x awake\n", id); }