From 206d525e6bfd7388dc07c636ad378d1f5c327cd5 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Thu, 10 Jul 2014 10:31:22 -0500 Subject: [PATCH] LU-5320: fixes for errors found by coccinelle This patch fixes 3 errors found by coccinelle (a static analyser): lustre/ptlrpc/nrs_tbf.c:312:2-8: preceding lock on line 307 lustre/fid/fid_handler.c:73:43-51: ERROR: cli is NULL but dereferenced. lustre/lfsck/lfsck_lib.c:1564:1-10: second lock on line 1571 Signed-off-by: Frank Zago Change-Id: Ic00a5c1dd331df879d6a10f11a07ef14f2beefd8 Reviewed-on: http://review.whamcloud.com/11047 Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Tested-by: Jenkins Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Fan Yong Tested-by: Maloo --- lustre/fid/fid_handler.c | 11 +++++------ lustre/lfsck/lfsck_lib.c | 2 +- lustre/ptlrpc/nrs_tbf.c | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index e3473d5..2e3efff 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -68,12 +68,11 @@ int seq_server_set_cli(const struct lu_env *env, struct lu_server_seq *seq, */ mutex_lock(&seq->lss_mutex); - if (cli == NULL) { - CDEBUG(D_INFO, "%s: Detached sequence client %s\n", - seq->lss_name, cli->lcs_name); - seq->lss_cli = cli; - GOTO(out_up, rc = 0); - } + if (cli == NULL) { + CDEBUG(D_INFO, "%s: Detached sequence client\n", seq->lss_name); + seq->lss_cli = NULL; + GOTO(out_up, rc = 0); + } if (seq->lss_cli != NULL) { CDEBUG(D_HA, "%s: Sequence controller is already " diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index b669e42..fe3fcad 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -1568,7 +1568,7 @@ static int lfsck_stop_notify(const struct lu_env *env, &lfsck->li_list_double_scan); if (com != NULL) lfsck_component_get(com); - spin_lock(&lfsck->li_lock); + spin_unlock(&lfsck->li_lock); if (com != NULL) { if (com->lc_ops->lfsck_stop_notify != NULL) { diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index 2dedef3..62d0490 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -307,6 +307,7 @@ nrs_tbf_rule_start(struct ptlrpc_nrs_policy *policy, spin_lock(&head->th_rule_lock); tmp_rule = nrs_tbf_rule_find_nolock(head, start->tc_name); if (tmp_rule) { + spin_unlock(&head->th_rule_lock); nrs_tbf_rule_put(tmp_rule); nrs_tbf_rule_put(rule); return -EEXIST; -- 1.8.3.1