Whamcloud - gitweb
LU-5320: fixes for errors found by coccinelle 47/11047/3
authorFrank Zago <fzago@cray.com>
Thu, 10 Jul 2014 15:31:22 +0000 (10:31 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 11 Jul 2014 02:58:31 +0000 (02:58 +0000)
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 <fzago@cray.com>
Change-Id: Ic00a5c1dd331df879d6a10f11a07ef14f2beefd8
Reviewed-on: http://review.whamcloud.com/11047
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/fid/fid_handler.c
lustre/lfsck/lfsck_lib.c
lustre/ptlrpc/nrs_tbf.c

index e3473d5..2e3efff 100644 (file)
@@ -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 "
index b669e42..fe3fcad 100644 (file)
@@ -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) {
index 2dedef3..62d0490 100644 (file)
@@ -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;