From patchwork Thu Dec 9 16:48:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 395112 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB9GmE1Y022612 for ; Thu, 9 Dec 2010 16:48:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752988Ab0LIQsv (ORCPT ); Thu, 9 Dec 2010 11:48:51 -0500 Received: from mail-gx0-f180.google.com ([209.85.161.180]:59801 "EHLO mail-gx0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807Ab0LIQsu (ORCPT ); Thu, 9 Dec 2010 11:48:50 -0500 Received: by mail-gx0-f180.google.com with SMTP id 19so1559138gxk.11 for ; Thu, 09 Dec 2010 08:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:subject:to:date :message-id:in-reply-to:references:user-agent:mime-version :content-type:content-transfer-encoding; bh=nIHL4HRn/Ycy5Jnn1KihtY6Vu4yrHkIVuGpARjs4WdQ=; b=YyPB6QXbobcfEsGJCYAWMP1zSbZRGLrGED+8s3lSLXf/uCrw5WkXj95YHIoMUPiCb0 6Xj0IKZ/c3DkMBZOmXp2MkCxopgNyfRFmBlsipOsauoQNiGTRC1OUefz0t3rVEmQoQIg VpZ2558D7fGQxXqfIzcJ59An2GZChlVzPsReI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:subject:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=dZuQn89aXdGkJSHu4D+GyR7i5LxR/3h16YZNYS5z/NZ45c9dogXKg/1v6CpLxzrPS4 1DoWp9oO4HS8YcMXjlJhXE5XprdYZm2zdyE05kykXZvHHHTd+wfYj8ILYNUxGAFUVhAY ucPZAXK2eTxKa8GNEyZMdnlHMInICSAA6edI8= Received: by 10.90.84.16 with SMTP id h16mr12049775agb.130.1291913330635; Thu, 09 Dec 2010 08:48:50 -0800 (PST) Received: from matisse.1015granger.net ([99.26.161.222]) by mx.google.com with ESMTPS id c28sm1461544ana.21.2010.12.09.08.48.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Dec 2010 08:48:49 -0800 (PST) From: Chuck Lever Subject: [PATCH 04/11] lockd: Add nlm_destroy_host_locked() To: linux-nfs@vger.kernel.org Date: Thu, 09 Dec 2010 11:48:47 -0500 Message-ID: <20101209164847.4513.15855.stgit@matisse.1015granger.net> In-Reply-To: <20101209163555.4513.94435.stgit@matisse.1015granger.net> References: <20101209163555.4513.94435.stgit@matisse.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 09 Dec 2010 16:48:52 +0000 (UTC) diff --git a/fs/lockd/host.c b/fs/lockd/host.c index ed1895a..52e21c3 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -227,16 +227,21 @@ out: } /* - * Destroy a host + * Destroy an nlm_host and free associated resources + * + * Caller must hold nlm_host_mutex. */ -static void -nlm_destroy_host(struct nlm_host *host) +static void nlm_destroy_host_locked(struct nlm_host *host) { struct rpc_clnt *clnt; + dprintk("lockd: destroy host %s\n", host->h_name); + BUG_ON(!list_empty(&host->h_lockowners)); BUG_ON(atomic_read(&host->h_count)); + hlist_del_init(&host->h_hash); + nsm_unmonitor(host); nsm_release(host->h_nsmhandle); @@ -244,6 +249,8 @@ nlm_destroy_host(struct nlm_host *host) if (clnt != NULL) rpc_shutdown_client(clnt); kfree(host); + + nrhosts--; } /** @@ -585,11 +592,7 @@ nlm_gc_hosts(void) host->h_inuse, host->h_expires); continue; } - dprintk("lockd: delete host %s\n", host->h_name); - hlist_del_init(&host->h_hash); - - nlm_destroy_host(host); - nrhosts--; + nlm_destroy_host_locked(host); } next_gc = jiffies + NLM_HOST_COLLECT;