From patchwork Wed Jul 23 20:17:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4612931 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 802FBC0515 for ; Wed, 23 Jul 2014 20:17:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2C4720154 for ; Wed, 23 Jul 2014 20:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C1C99201BC for ; Wed, 23 Jul 2014 20:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932847AbaGWURu (ORCPT ); Wed, 23 Jul 2014 16:17:50 -0400 Received: from mail-qa0-f44.google.com ([209.85.216.44]:65436 "EHLO mail-qa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933336AbaGWURt (ORCPT ); Wed, 23 Jul 2014 16:17:49 -0400 Received: by mail-qa0-f44.google.com with SMTP id f12so1876410qad.3 for ; Wed, 23 Jul 2014 13:17:49 -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=DK4tBQHJdbb2nEmbFpai5Iyk7eM75JH0g9Ej98YF3wY=; b=E6NuzHQTCPyKEGnj+11ScsNe79ZFpHoJnfAYT/PfpLY1zcMiy/l4vLbkw5w8bLl0dT XdDyxuq0f9T8prWwP2pay7xX2MSFYkENApnBsRHbxKmGXgUlWvCtIlEo/gBeTduvYWmX glTrcatMTIzyIyDA9N1s8OeAVZOK5epu1fyCCKHch9AZAUVxOdY2Uvnl9XPCNPDrQdBl 17kctSCZIz7Y0mCyMeg26LUOv6IJb59XgFpk7xxUfRnnJopLv5n7nkNR41Jw54uFFBcq zw1Kw7nv/8mHIFPk988oolPsq3+6scvdbHQgg73EPKPHpgBRyJYXvzlZrQjvFIg0rHrz mt1g== X-Gm-Message-State: ALoCoQnMpKYjPW8bexGOAng79xBIMqbdugy/fPqW4Ra+GP+X2o6LLpKJN6fVQJXzT4LJWIIzgLMb X-Received: by 10.140.106.74 with SMTP id d68mr5559899qgf.103.1406146669123; Wed, 23 Jul 2014 13:17:49 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id l69sm4601235qgd.17.2014.07.23.13.17.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jul 2014 13:17:48 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, trond.myklebust@primarydata.com, hch@infradead.org Subject: [PATCH v2 1/4] nfsd: Store the filehandle with the struct nfs4_file Date: Wed, 23 Jul 2014 16:17:38 -0400 Message-Id: <1406146661-9794-2-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406146661-9794-1-git-send-email-jlayton@primarydata.com> References: <1406146661-9794-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, 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 For use when we may not have a struct inode. Signed-off-by: Trond Myklebust Signed-off-by: Jeff Layton --- fs/nfsd/nfs4state.c | 10 ++++++---- fs/nfsd/state.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 66a3b843a82b..859891f30958 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2833,7 +2833,8 @@ static struct nfs4_file *nfsd4_alloc_file(void) } /* OPEN Share state helper functions */ -static void nfsd4_init_file(struct nfs4_file *fp, struct inode *ino) +static void nfsd4_init_file(struct nfs4_file *fp, struct inode *ino, + struct knfsd_fh *fh) { unsigned int hashval = file_hashval(ino); @@ -2845,6 +2846,7 @@ static void nfsd4_init_file(struct nfs4_file *fp, struct inode *ino) INIT_LIST_HEAD(&fp->fi_delegations); ihold(ino); fp->fi_inode = ino; + fh_copy_shallow(&fp->fi_fhandle, fh); fp->fi_had_conflict = false; fp->fi_lease = NULL; fp->fi_share_deny = 0; @@ -3049,14 +3051,14 @@ find_file(struct inode *ino) } static struct nfs4_file * -find_or_add_file(struct inode *ino, struct nfs4_file *new) +find_or_add_file(struct inode *ino, struct nfs4_file *new, struct knfsd_fh *fh) { struct nfs4_file *fp; spin_lock(&state_lock); fp = find_file_locked(ino); if (fp == NULL) { - nfsd4_init_file(new, ino); + nfsd4_init_file(new, ino, fh); fp = new; } spin_unlock(&state_lock); @@ -3711,7 +3713,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf * and check for delegations in the process of being recalled. * If not found, create the nfs4_file struct */ - fp = find_or_add_file(ino, open->op_file); + fp = find_or_add_file(ino, open->op_file, ¤t_fh->fh_handle); if (fp != open->op_file) { status = nfs4_check_deleg(cl, open, &dp); if (status) diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index e68a9ae30fd7..33cf950b3873 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -396,6 +396,7 @@ struct nfs4_file { struct file *fi_deleg_file; struct file_lock *fi_lease; atomic_t fi_delegees; + struct knfsd_fh fi_fhandle; struct inode *fi_inode; bool fi_had_conflict; };