1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
6 * This file is part of the Lustre file system, http://www.lustre.org
7 * Lustre is a trademark of Cluster File Systems, Inc.
9 * You may have signed or agreed to another license before downloading
10 * this software. If so, you are bound by the terms and conditions
11 * of that agreement, and the following does not apply to you. See the
12 * LICENSE file included with this distribution for more information.
14 * If you did not agree to a different license, then this copy of Lustre
15 * is open source software; you can redistribute it and/or modify it
16 * under the terms of version 2 of the GNU General Public License as
17 * published by the Free Software Foundation.
19 * In either case, Lustre is distributed in the hope that it will be
20 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
21 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * license text for more details.
26 #define DEBUG_SUBSYSTEM S_LDLM
28 #include <libcfs/libcfs.h>
30 #include <liblustre.h>
33 #include <lustre_dlm.h>
34 #include <lustre_lib.h>
37 * ldlm locking uses resource to serialize access to locks
38 * but there is a case when we change resource of lock upon
39 * enqueue reply. we rely on that lock->l_resource = new_res
42 struct ldlm_resource * lock_res_and_lock(struct ldlm_lock *lock)
44 struct ldlm_resource *res = lock->l_resource;
46 if (!res->lr_namespace->ns_client) {
47 /* on server-side resource of lock doesn't change */
53 res = lock->l_resource;
58 void unlock_res_and_lock(struct ldlm_lock *lock)
60 struct ldlm_resource *res = lock->l_resource;
62 if (!res->lr_namespace->ns_client) {
63 /* on server-side resource of lock doesn't change */