From patchwork Mon Jun 30 15:48:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4451141 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 C0531BEEAA for ; Mon, 30 Jun 2014 15:50:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E93942021F for ; Mon, 30 Jun 2014 15:50:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DD0220379 for ; Mon, 30 Jun 2014 15:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754518AbaF3Puq (ORCPT ); Mon, 30 Jun 2014 11:50:46 -0400 Received: from mail-qa0-f49.google.com ([209.85.216.49]:46577 "EHLO mail-qa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754038AbaF3Pup (ORCPT ); Mon, 30 Jun 2014 11:50:45 -0400 Received: by mail-qa0-f49.google.com with SMTP id w8so6446860qac.22 for ; Mon, 30 Jun 2014 08:50:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=c0evUNhPBXS1h0nzYwoC8zRwCg41OD3PzL96h3JWLoU=; b=P8A0NBIYZz7/ENzs85/wOcC+AtIFpN0DJHus5BNJRNhPVb/Ug8Kc3okN6M68jxD/4r abTePxyQsVizxka8sfCDqfSC1exomUD0vs1RlmOeOYdjE2ghm5b3KN18HsyDpEyZnpTK 9tDWN9lHLlARKU2ghGlmq0cyQiAyjCOdiD2Fb3Pqjbdwjt5D5rMVk5bE3YaYg17QItcJ z7bsnNM0xKfofixrQ/tayKXuDl8UYjDJ7M7nC6VxJT7LATUU3qBtaszs8WRECxIFLlUn pBnU8rU1nHGViEYIDLykwrlE59o7OaB6FyOZXHNI9ZC1GnR2UOAbQqpeeQEgEioILcVM G8zA== X-Gm-Message-State: ALoCoQlMgdjnN6PYir2XsTjO2mwQ9suuiv3zgN32rSt7TePzvvZNI5XVEk5zhOVzh7NaAeF+QBSh X-Received: by 10.140.41.116 with SMTP id y107mr58180846qgy.78.1404143444222; Mon, 30 Jun 2014 08:50:44 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id m1sm32584105qaz.27.2014.06.30.08.50.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jun 2014 08:50:43 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Trond Myklebust Subject: [PATCH v3 008/114] nfsd: clean up nfsd4_close_open_stateid Date: Mon, 30 Jun 2014 11:48:37 -0400 Message-Id: <1404143423-24381-9-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1404143423-24381-1-git-send-email-jlayton@primarydata.com> References: <1404143423-24381-1-git-send-email-jlayton@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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 From: Trond Myklebust Minor cleanup that should introduce no behavioral changes. Currently this function just unhashes the stateid and leaves the caller to do the work of the CLOSE processing. Change nfsd4_close_open_stateid so that it handles doing all of the work of closing a stateid. Move the handling of the unhashed stateid into it instead of doing that work in nfsd4_close. This will help isolate some coming changes to stateid handling from nfsd4_close. Signed-off-by: Trond Myklebust Reviewed-by: Christoph Hellwig --- fs/nfsd/nfs4state.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index e77e34002913..08586646e962 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4140,8 +4140,25 @@ out: static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) { - unhash_open_stateid(s); + struct nfs4_client *clp = s->st_stid.sc_client; + struct nfs4_openowner *oo = openowner(s->st_stateowner); + s->st_stid.sc_type = NFS4_CLOSED_STID; + unhash_open_stateid(s); + + if (clp->cl_minorversion) { + free_generic_stateid(s); + if (list_empty(&oo->oo_owner.so_stateids)) + release_openowner(oo); + } else { + oo->oo_last_closed_stid = s; + /* + * In the 4.0 case we need to keep the owners around a + * little while to handle CLOSE replay. + */ + if (list_empty(&oo->oo_owner.so_stateids)) + move_to_close_lru(oo, clp->net); + } } /* @@ -4152,7 +4169,6 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_close *close) { __be32 status; - struct nfs4_openowner *oo; struct nfs4_ol_stateid *stp; struct net *net = SVC_NET(rqstp); struct nfsd_net *nn = net_generic(net, nfsd_net_id); @@ -4168,28 +4184,10 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_bump_seqid(cstate, status); if (status) goto out; - oo = openowner(stp->st_stateowner); update_stateid(&stp->st_stid.sc_stateid); memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); nfsd4_close_open_stateid(stp); - - if (cstate->minorversion) - free_generic_stateid(stp); - else - oo->oo_last_closed_stid = stp; - - if (list_empty(&oo->oo_owner.so_stateids)) { - if (cstate->minorversion) - release_openowner(oo); - else { - /* - * In the 4.0 case we need to keep the owners around a - * little while to handle CLOSE replay. - */ - move_to_close_lru(oo, SVC_NET(rqstp)); - } - } out: if (!cstate->replay_owner) nfs4_unlock_state();