From patchwork Thu Sep 26 18:43:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 2950531 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 759BCBFF0B for ; Thu, 26 Sep 2013 18:43:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 955F5202F0 for ; Thu, 26 Sep 2013 18:43:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAF4B202E6 for ; Thu, 26 Sep 2013 18:43:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751405Ab3IZSnK (ORCPT ); Thu, 26 Sep 2013 14:43:10 -0400 Received: from mail-qa0-f51.google.com ([209.85.216.51]:37554 "EHLO mail-qa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447Ab3IZSnJ (ORCPT ); Thu, 26 Sep 2013 14:43:09 -0400 Received: by mail-qa0-f51.google.com with SMTP id j15so1100736qaq.17 for ; Thu, 26 Sep 2013 11:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=SfwBnn3h6jpqrkY5U7rOq+aEOg+SRM2EgWUsz+OxgG8=; b=VjJIrf9wOIh5p0Xqc0A+Ks14KBgYnbUadPV0sIZ4tKDCW7FLxO/iR+wzb7cA9b720P vOjJJ/xp+UF3b0U4pl+mGDUCzAY+eLGvVlelYi/Ta1AzkCPFGkC3h97ZLkOIhROqHuMf OI83yEaZnQGtmqg9K+hKEKwIsZG+AO6nnnqR4f2L9C4H1GBKAS4MhD7QXXwTmgA6soLn jp8P7mMVLrPqRVqCQxpSm4YHf68nwP1yccH4D14WrBoBwuAn0T7hS4Bo4fwBvdmihtKN QD5fNHdYir80lSThw2FQym5dYPddDm0G/ML4oWnQCwks7rYl4wRPiAZQtscI4zxnWpeS egRA== X-Received: by 10.224.36.146 with SMTP id t18mr4267774qad.111.1380220989347; Thu, 26 Sep 2013 11:43:09 -0700 (PDT) Received: from bhalevy-lt.il.tonian.com.com (nat-pool-bos-u.redhat.com. [66.187.233.207]) by mx.google.com with ESMTPSA id a7sm5144360qew.2.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 26 Sep 2013 11:43:08 -0700 (PDT) From: Benny Halevy To: " J. Bruce Fields" Cc: linux-nfs@vger.kernel.org Subject: [PATCH RFC v0 47/49] pnfsd: pnfs_expire_client Date: Thu, 26 Sep 2013 14:43:07 -0400 Message-Id: <1380220987-14853-1-git-send-email-bhalevy@primarydata.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <52447EA0.7070004@primarydata.com> References: <52447EA0.7070004@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Destroy the client layout state upon expiry. pnfs_return_client_layouts is used to locate the related layout state as if the client returned all of its layouts via RETURN_ALL with IOMODE_ANY. Signed-off-by: Benny Halevy --- fs/nfsd/nfs4pnfsd.c | 22 ++++++++++++++++++++++ fs/nfsd/nfs4state.c | 1 + fs/nfsd/state.h | 2 ++ 3 files changed, 25 insertions(+) diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c index 2ba4a29..d18e2a1 100644 --- a/fs/nfsd/nfs4pnfsd.c +++ b/fs/nfsd/nfs4pnfsd.c @@ -862,3 +862,25 @@ int nfs4_pnfs_return_layout(struct svc_rqst *rqstp, dprintk("pNFS %s: exit status %d\n", __func__, status); return status; } + +/* + * Note: must be called under the state lock + */ +void pnfs_expire_client(struct nfs4_client *clp) +{ + struct nfsd4_pnfs_layoutreturn lr = { + .args.lr_return_type = RETURN_ALL, + .args.lr_seg = { + .iomode = IOMODE_ANY, + .offset = 0, + .length = NFS4_MAX_UINT64, + }, + }; + LIST_HEAD(lo_destroy_list); + + nfs4_assert_state_locked(); + + pnfs_return_client_layouts(clp, &lr, 0, &lo_destroy_list); + + destroy_layout_list(&lo_destroy_list); +} diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index a9bd82b..600edbc 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1172,6 +1172,7 @@ static struct nfs4_client *alloc_client(struct xdr_netobj name) oo = list_entry(clp->cl_openowners.next, struct nfs4_openowner, oo_perclient); release_openowner(oo); } + pnfs_expire_client(clp); nfsd4_shutdown_callback(clp); if (clp->cl_cb_conn.cb_xprt) svc_xprt_put(clp->cl_cb_conn.cb_xprt); diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index d2c75c5..90ec8b9 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -506,9 +506,11 @@ extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(const char *name, #if defined(CONFIG_PNFSD) extern int nfsd4_init_pnfs_slabs(void); extern void nfsd4_free_pnfs_slabs(void); +extern void pnfs_expire_client(struct nfs4_client *); #else /* CONFIG_PNFSD */ static inline void nfsd4_free_pnfs_slabs(void) {} static inline int nfsd4_init_pnfs_slabs(void) { return 0; } +static inline void pnfs_expire_client(struct nfs4_client *clp) {} #endif /* CONFIG_PNFSD */ static inline u64