From patchwork Tue Dec 14 15:05:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 410311 X-Patchwork-Delegate: Trond.Myklebust@netapp.com 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 oBEF5SFv013575 for ; Tue, 14 Dec 2010 15:05:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757409Ab0LNPFg (ORCPT ); Tue, 14 Dec 2010 10:05:36 -0500 Received: from mail-yx0-f174.google.com ([209.85.213.174]:39378 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755862Ab0LNPFg (ORCPT ); Tue, 14 Dec 2010 10:05:36 -0500 Received: by mail-yx0-f174.google.com with SMTP id 3so384384yxt.19 for ; Tue, 14 Dec 2010 07:05:36 -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:cc :date:message-id:in-reply-to:references:user-agent:mime-version :content-type:content-transfer-encoding; bh=qqW1aScHjfIEIbEXB2Jvp0HlLYmo5ryNxNM6zj6xNo8=; b=H+ZPoWabbTshRaulRt8P2v7Qe99QQ0jgtNYMC/mLlJOZaesC4gN10jzdVRaThcZt5r FHmzJ7DNDq2XvQn5JBwhMuBeqt6rQ49DNhiBSbiuy2TU1l7jTcVrZgTB4JBaZcBy/0Nl U7EZHWsla1cdTX7IJOdB8lFprJAeRlEniX76g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=D7FWFhNaYOs4pNAfn96vJ5nieUguVTj8uRjE0mOU5dQI2rUSmCD9UQ2eIJeH7Owzov ij1u5T54B4NQWMiIQqY0hqk95p/R2x4R2Tf5C2SvxZIni4c1TSXXxi7CKBf1zJ/KeuWu I0NzrEJ6Tqxu+HXdJCWhQ6RdJXqth3t88M9Ak= Received: by 10.42.171.137 with SMTP id j9mr4323396icz.178.1292339135740; Tue, 14 Dec 2010 07:05:35 -0800 (PST) Received: from matisse.1015granger.net ([99.26.161.222]) by mx.google.com with ESMTPS id 34sm102412ibi.20.2010.12.14.07.05.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 14 Dec 2010 07:05:34 -0800 (PST) From: Chuck Lever Subject: [PATCH 04/11] lockd: Add nlm_destroy_host_locked() To: trond.myklebust@netapp.com Cc: linux-nfs@vger.kernel.org Date: Tue, 14 Dec 2010 10:05:33 -0500 Message-ID: <20101214150533.2736.74362.stgit@matisse.1015granger.net> In-Reply-To: <20101214150036.2736.98254.stgit@matisse.1015granger.net> References: <20101214150036.2736.98254.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]); Tue, 14 Dec 2010 15:05:37 +0000 (UTC) diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 1911f34..e58e142 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -231,16 +231,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); @@ -248,6 +253,8 @@ nlm_destroy_host(struct nlm_host *host) if (clnt != NULL) rpc_shutdown_client(clnt); kfree(host); + + nrhosts--; } /** @@ -589,11 +596,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;