X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flov%2Flov_lock.c;h=de55b2de2f254ea0c6b248e28131d6985bc8bc3f;hb=a585b03a36e61b9039f87135e1542094ae0d6e28;hp=2424581f89911aa2559042556568f24287cd9a55;hpb=ecaba99677b28536f9c376b2b835b554a7792668;p=fs%2Flustre-release.git diff --git a/lustre/lov/lov_lock.c b/lustre/lov/lov_lock.c index 2424581..de55b2d 100644 --- a/lustre/lov/lov_lock.c +++ b/lustre/lov/lov_lock.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Whamcloud, Inc. + * Copyright (c) 2011, 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -652,8 +652,19 @@ static int lov_lock_enqueue(const struct lu_env *env, sublock); break; case CLS_CACHED: + cl_lock_get(sublock); + /* take recursive mutex of sublock */ + cl_lock_mutex_get(env, sublock); + /* need to release all locks in closure + * otherwise it may deadlock. LU-2683.*/ + lov_sublock_unlock(env, sub, closure, + subenv); + /* sublock and parent are held. */ rc = lov_sublock_release(env, lck, i, 1, rc); + cl_lock_mutex_put(env, sublock); + cl_lock_put(env, sublock); + break; default: lov_sublock_unlock(env, sub, closure, subenv); @@ -1007,6 +1018,11 @@ static int lov_lock_fits_into(const struct lu_env *env, ENTRY; + /* for top lock, it's necessary to match enq flags otherwise it will + * run into problem if a sublock is missing and reenqueue. */ + if (need->cld_enq_flags != lov->lls_orig.cld_enq_flags) + return 0; + if (need->cld_mode == CLM_GROUP) /* * always allow to match group lock. @@ -1200,6 +1216,7 @@ static int lov_empty_lock_print(const struct lu_env *env, void *cookie, return 0; } +/* XXX: more methods will be added later. */ static const struct cl_lock_operations lov_empty_lock_ops = { .clo_fini = lov_empty_lock_fini, .clo_print = lov_empty_lock_print