From patchwork Mon Jul 21 22:54:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 4598631 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 54BC69F295 for ; Mon, 21 Jul 2014 22:54:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5225120120 for ; Mon, 21 Jul 2014 22:54:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B6AB20109 for ; Mon, 21 Jul 2014 22:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750743AbaGUWyZ (ORCPT ); Mon, 21 Jul 2014 18:54:25 -0400 Received: from mail-ig0-f176.google.com ([209.85.213.176]:46686 "EHLO mail-ig0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750737AbaGUWyZ (ORCPT ); Mon, 21 Jul 2014 18:54:25 -0400 Received: by mail-ig0-f176.google.com with SMTP id hn18so3374448igb.9 for ; Mon, 21 Jul 2014 15:54:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=biKV+UHOYyUyRGEVgsj1OWezSgHlSl2J/O1B+pXoFUo=; b=ckn+Lm6iYS3vpTc9b38ZXD8LQeejHh88EkAF6zK9SprVBbaNXq20wPPb2gWU85SkZJ /hqvaZDHfHLjuyM/NfNhjtCBJNZ6VzDZngiM87T9ltGMbPbvd7MhRyYYA5oaynO+MRDM qs0hNAwBoKPGxxLAMI6DgWv/LNoMSes313d6kVwztmeOrf5NXj2OLO8h1/R+xAxZMihE NEHj/HNXJNlBcygq3TkWtMF95x++44gL9vvL0laow0gkL74TtfJ7QjgMVHndM7Apg43a LMfQNmDJeGyQXem8TRwe/siBPzQiRVO1NWI9aLd+cgo/P8QHVKnPVrCalhtjgqDetdy1 nfXA== X-Gm-Message-State: ALoCoQlHqinS95nLPfc7D3Vrj7sFPuByxvz69v60llEDVXh2p5nwSfJKWisTc5bc17iR848nq2uL X-Received: by 10.42.22.193 with SMTP id p1mr17494736icb.43.1405983264472; Mon, 21 Jul 2014 15:54:24 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (c-98-209-19-95.hsd1.mi.comcast.net. [98.209.19.95]) by mx.google.com with ESMTPSA id z11sm21194744igm.13.2014.07.21.15.54.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Jul 2014 15:54:23 -0700 (PDT) From: Trond Myklebust To: Jeff Layton Cc: linux-nfs@vger.kernel.org Subject: [PATCH 1/4] knfsd: Store the filehandle with the struct nfs4_file Date: Mon, 21 Jul 2014 18:54:28 -0400 Message-Id: <1405983271-61861-1-git-send-email-trond.myklebust@primarydata.com> X-Mailer: git-send-email 1.9.3 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 For use when we may not have a struct inode. Signed-off-by: Trond Myklebust --- 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 08ee9ca13cb1..55bc43674fce 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2805,7 +2805,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); @@ -2814,6 +2815,7 @@ static void nfsd4_init_file(struct nfs4_file *fp, struct inode *ino) INIT_LIST_HEAD(&fp->fi_stateids); INIT_LIST_HEAD(&fp->fi_delegations); fp->fi_inode = igrab(ino); + fh_copy_shallow(&fp->fi_fhandle, fh); fp->fi_had_conflict = false; fp->fi_lease = NULL; memset(fp->fi_fds, 0, sizeof(fp->fi_fds)); @@ -3073,14 +3075,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); @@ -3669,7 +3671,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) { if ((status = nfs4_check_open(fp, open, &stp))) goto out; diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index f11c74f3d40d..38c575c084e4 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -405,6 +405,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; };