X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fobdclass%2Fgenops.c;h=e0a9416e86648cbb54fed846160d3a01a237c9c8;hp=9a9adfa4d409b018e973c10465b30180643a5705;hb=c4e3a69dd9a335d54f747d2e969edefe7bcce4cd;hpb=a6298212ec2354f815bf06c1b34fc4b27bd35a00 diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 9a9adfa..e0a9416 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -1464,6 +1464,9 @@ void obd_exports_barrier(struct obd_device *obd) } EXPORT_SYMBOL(obd_exports_barrier); +/* Total amount of zombies to be destroyed */ +static int zombies_count = 0; + /** * kill zombie imports and exports */ @@ -1494,11 +1497,19 @@ void obd_zombie_impexp_cull(void) cfs_spin_unlock(&obd_zombie_impexp_lock); - if (import != NULL) + if (import != NULL) { class_import_destroy(import); + cfs_spin_lock(&obd_zombie_impexp_lock); + zombies_count--; + cfs_spin_unlock(&obd_zombie_impexp_lock); + } - if (export != NULL) + if (export != NULL) { class_export_destroy(export); + cfs_spin_lock(&obd_zombie_impexp_lock); + zombies_count--; + cfs_spin_unlock(&obd_zombie_impexp_lock); + } cfs_cond_resched(); } while (import != NULL || export != NULL); @@ -1523,10 +1534,8 @@ static int obd_zombie_impexp_check(void *arg) int rc; cfs_spin_lock(&obd_zombie_impexp_lock); - rc = cfs_list_empty(&obd_zombie_imports) && - cfs_list_empty(&obd_zombie_exports) && + rc = (zombies_count == 0) && !cfs_test_bit(OBD_ZOMBIE_STOP, &obd_zombie_flags); - cfs_spin_unlock(&obd_zombie_impexp_lock); RETURN(rc); @@ -1541,6 +1550,7 @@ static void obd_zombie_export_add(struct obd_export *exp) { cfs_list_del_init(&exp->exp_obd_chain); cfs_spin_unlock(&exp->exp_obd->obd_dev_lock); cfs_spin_lock(&obd_zombie_impexp_lock); + zombies_count++; cfs_list_add(&exp->exp_obd_chain, &obd_zombie_exports); cfs_spin_unlock(&obd_zombie_impexp_lock); @@ -1555,6 +1565,7 @@ static void obd_zombie_import_add(struct obd_import *imp) { LASSERT(imp->imp_sec == NULL); cfs_spin_lock(&obd_zombie_impexp_lock); LASSERT(cfs_list_empty(&imp->imp_zombie_chain)); + zombies_count++; cfs_list_add(&imp->imp_zombie_chain, &obd_zombie_imports); cfs_spin_unlock(&obd_zombie_impexp_lock); @@ -1579,8 +1590,7 @@ static int obd_zombie_is_idle(void) LASSERT(!cfs_test_bit(OBD_ZOMBIE_STOP, &obd_zombie_flags)); cfs_spin_lock(&obd_zombie_impexp_lock); - rc = cfs_list_empty(&obd_zombie_imports) && - cfs_list_empty(&obd_zombie_exports); + rc = (zombies_count == 0); cfs_spin_unlock(&obd_zombie_impexp_lock); return rc; }