staging/lustre/o2iblnd: leak cmid in kiblnd_dev_need_failover
authorLiang Zhen <liang.zhen@intel.com>
Mon, 14 Sep 2015 22:41:33 +0000 (18:41 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 Sep 2015 13:26:55 +0000 (06:26 -0700)
cmid created by kiblnd_dev_need_failover should always be destroyed,
however it is not the case in current implementation and we will leak
cmid when this function detected a device failover.

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-on: http://review.whamcloud.com/14603
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6480
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c

index c29d2ced258ce4339f684da4e83bf57050f5f6c1..faa70f0b9b1ee8a881c3a7b516b4fc5fc0f1ae3e 100644 (file)
@@ -2228,13 +2228,10 @@ static int kiblnd_dev_need_failover(kib_dev_t *dev)
                return rc;
        }
 
-       if (dev->ibd_hdev->ibh_ibdev == cmid->device) {
-               /* don't need device failover */
-               rdma_destroy_id(cmid);
-               return 0;
-       }
+       rc = dev->ibd_hdev->ibh_ibdev != cmid->device; /* true for failover */
+       rdma_destroy_id(cmid);
 
-       return 1;
+       return rc;
 }
 
 int kiblnd_dev_failover(kib_dev_t *dev)