scsi: target: alua: fix the tg_pt_gps_count
authortangwenji <tang.wenji@zte.com.cn>
Wed, 27 Mar 2019 13:59:06 +0000 (21:59 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 28 Mar 2019 00:33:07 +0000 (20:33 -0400)
Reducing the count should be alua_tg_pt_gps_count instead of
alua_tg_pt_gps_counter when free alua group.

Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_alua.c

index e09f0cf86bed8620fae7810e0e7496efefa735b6..893f1fe8e373ce6a4be5e600465620a727783f3e 100644 (file)
@@ -1760,8 +1760,10 @@ void core_alua_free_tg_pt_gp(
         * can be made while we are releasing struct t10_alua_tg_pt_gp.
         */
        spin_lock(&dev->t10_alua.tg_pt_gps_lock);
-       list_del(&tg_pt_gp->tg_pt_gp_list);
-       dev->t10_alua.alua_tg_pt_gps_counter--;
+       if (tg_pt_gp->tg_pt_gp_valid_id) {
+               list_del(&tg_pt_gp->tg_pt_gp_list);
+               dev->t10_alua.alua_tg_pt_gps_count--;
+       }
        spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
 
        /*