X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fptlrpc%2Fllog_client.c;h=eb69a4a6917824ce05cb85ae066754bab1e6b52f;hp=12b839375c318b3183aba6590d45c7de865c7e85;hb=39cecbf532a266aac8caea8b215dcec281a31d73;hpb=70e80ade90af09300396706b8910e196a7928520;ds=sidebyside diff --git a/lustre/ptlrpc/llog_client.c b/lustre/ptlrpc/llog_client.c index 12b8393..eb69a4a 100644 --- a/lustre/ptlrpc/llog_client.c +++ b/lustre/ptlrpc/llog_client.c @@ -1,6 +1,4 @@ -/* -*- 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. @@ -16,8 +14,8 @@ * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see [sun.com URL with a - * copy of GPLv2]. + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or @@ -26,8 +24,10 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -42,10 +42,6 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifndef EXPORT_SYMTAB -#define EXPORT_SYMTAB -#endif - #ifdef __KERNEL__ #include #else @@ -57,8 +53,8 @@ #include #include -#define LLOG_CLIENT_ENTRY(ctxt, imp) do { \ - mutex_down(&ctxt->loc_sem); \ +#define LLOG_CLIENT_ENTRY(ctxt, imp) do { \ + cfs_mutex_lock(&ctxt->loc_mutex); \ if (ctxt->loc_imp) { \ imp = class_import_get(ctxt->loc_imp); \ } else { \ @@ -67,19 +63,19 @@ "but I'll try again next time. Not fatal.\n", \ ctxt->loc_idx); \ imp = NULL; \ - mutex_up(&ctxt->loc_sem); \ + cfs_mutex_unlock(&ctxt->loc_mutex); \ return (-EINVAL); \ } \ - mutex_up(&ctxt->loc_sem); \ + cfs_mutex_unlock(&ctxt->loc_mutex); \ } while(0) -#define LLOG_CLIENT_EXIT(ctxt, imp) do { \ - mutex_down(&ctxt->loc_sem); \ - if (ctxt->loc_imp != imp) \ - CWARN("loc_imp has changed from %p to %p", \ - ctxt->loc_imp, imp); \ - class_import_put(imp); \ - mutex_up(&ctxt->loc_sem); \ +#define LLOG_CLIENT_EXIT(ctxt, imp) do { \ + cfs_mutex_lock(&ctxt->loc_mutex); \ + if (ctxt->loc_imp != imp) \ + CWARN("loc_imp has changed from %p to %p\n", \ + ctxt->loc_imp, imp); \ + class_import_put(imp); \ + cfs_mutex_unlock(&ctxt->loc_mutex); \ } while(0) /* This is a callback from the llog_* functions. @@ -113,6 +109,7 @@ static int llog_client_create(struct llog_ctxt *ctxt, struct llog_handle **res, LLOG_ORIGIN_HANDLE_CREATE); if (rc) { ptlrpc_request_free(req); + req = NULL; GOTO(err_free, rc); } ptlrpc_request_set_replen(req); @@ -146,6 +143,7 @@ out: ptlrpc_req_finished(req); return rc; err_free: + *res = NULL; llog_free_handle(handle); goto out; } @@ -353,3 +351,4 @@ struct llog_operations llog_client_ops = { lop_destroy: llog_client_destroy, lop_close: llog_client_close, }; +EXPORT_SYMBOL(llog_client_ops);