Browse files

27070 archive files are deleted but space is not reclaimed

  • Loading branch information...
1 parent bc1c2bc commit 276ccda5fa7fba148b00480f3cf2081d36fa6aff @grwilson grwilson committed Aug 14, 2013
Showing with 26 additions and 5 deletions.
  1. +26 −5 usr/src/uts/common/klm/nlm_impl.c
View
31 usr/src/uts/common/klm/nlm_impl.c
@@ -27,7 +27,7 @@
/*
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/*
@@ -374,6 +374,27 @@ nlm_gc(struct nlm_globals *g)
while ((hostp = TAILQ_FIRST(&g->nlm_idle_hosts)) != NULL) {
bool_t has_locks = FALSE;
+ /*
+ * A busy client will prevent the idle timeout from
+ * ever being reached but may have stale holds
+ * associated with it. If these stale holds are for
+ * vnodes which have been removed they will prevent
+ * the file system from being able to reclaim the
+ * file's space.
+ *
+ * To address this problem we unconditionally GC
+ * the host's vholds every time the GC runs. Since
+ * this is an expensive check, drop the global lock
+ * and only hold the host lock.
+ */
+ mutex_exit(&g->lock);
+ mutex_enter(&hostp->nh_lock);
+
+ nlm_host_gc_vholds(hostp);
+
+ mutex_exit(&hostp->nh_lock);
+ mutex_enter(&g->lock);
+
if (hostp->nh_idle_timeout > now)
break;
@@ -388,10 +409,10 @@ nlm_gc(struct nlm_globals *g)
/*
* nlm_globals lock was dropped earlier because
- * garbage collecting of vholds and checking whether
- * host has any locks/shares are expensive operations.
+ * checking is an expensive operation. In the worst
+ * case it may need to visit every file lock on the
+ * system.
*/
- nlm_host_gc_vholds(hostp);
has_locks = nlm_host_has_locks(hostp);
mutex_exit(&hostp->nh_lock);
@@ -1032,7 +1053,7 @@ nlm_vhold_destroy(struct nlm_host *hostp, struct nlm_vhold *nvp)
(mod_hash_val_t)&nvp) == 0);
TAILQ_REMOVE(&hostp->nh_vholds_list, nvp, nv_link);
- VN_RELE(nvp->nv_vp);
+ VN_RELE_ASYNC(nvp->nv_vp, system_taskq);
nvp->nv_vp = NULL;
kmem_cache_free(nlm_vhold_cache, nvp);

0 comments on commit 276ccda

Please sign in to comment.