From patchwork Thu Sep 4 12:38:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4845321 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 DD15EC0338 for ; Thu, 4 Sep 2014 12:45:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2E3C2026C for ; Thu, 4 Sep 2014 12:45:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6B9120274 for ; Thu, 4 Sep 2014 12:45:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753566AbaIDMn6 (ORCPT ); Thu, 4 Sep 2014 08:43:58 -0400 Received: from mail-qg0-f53.google.com ([209.85.192.53]:55527 "EHLO mail-qg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751449AbaIDMjI (ORCPT ); Thu, 4 Sep 2014 08:39:08 -0400 Received: by mail-qg0-f53.google.com with SMTP id z107so9776962qgd.40 for ; Thu, 04 Sep 2014 05:39:07 -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=SVBkcEW6gNkIoydeL9lO6r1+nQYyT4GTzspQcZuVRko=; b=EwzgscXndHc1LYbO1JEhXxx1GK0KqsAeyXoHfR5BRHnErlUtKw0YFt1eya5b/r2jX1 ynOp/AJL10qRQvllUHkJwSGnDX73Wdtv754IDthh3cJRSTSTw50Mf2IiVjw8qwl00itv HiXekuCVdeiitkJ5AD9ezzfxMR2H4CL/mBty56gCvzHrUUoHsw6Dts1LOdBBiHc3OwZp Q/fefM/hSuzyTWd4eugRIQHGGEys0A7QDbnZYubbqlJconHexW3t0HETs21j1i9vMszD 2SC33RiJj72c45lqPMtS/p7Oj7hmhIEzcYLNejxX+r+iJcgucEFbokn//0bdlQvaaXkW KbaA== X-Gm-Message-State: ALoCoQnVK3vLmaeDyttnZI3Efx9RmadJtLNA2GNTk7N8sEF3IeUtwwJ7HuS+eaVxFGRdlHzLYKZY X-Received: by 10.224.97.72 with SMTP id k8mr6640320qan.57.1409834347157; Thu, 04 Sep 2014 05:39:07 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id t5sm19186512qat.24.2014.09.04.05.39.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Sep 2014 05:39:06 -0700 (PDT) From: Jeff Layton To: linux-fsdevel@vger.kernel.org Cc: linux-nfs@vger.kernel.org, Christoph Hellwig , "J. Bruce Fields" , linux-kernel@vger.kernel.org Subject: [PATCH v2 07/17] nfsd: don't keep a pointer to the lease in nfs4_file Date: Thu, 4 Sep 2014 08:38:33 -0400 Message-Id: <1409834323-7171-8-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1409834323-7171-1-git-send-email-jlayton@primarydata.com> References: <1409834323-7171-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=-8.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Now that we don't need to pass in an actual lease pointer to vfs_setlease on unlock, we can stop tracking a pointer to the lease in the nfs4_file. Switch all of the places that check the fi_lease to check fi_deleg_file instead. We always set that at the same time so it will have the same semantics. Cc: J. Bruce Fields Signed-off-by: Jeff Layton Reviewed-by: Christoph Hellwig --- fs/nfsd/nfs4state.c | 10 ++++------ fs/nfsd/state.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 0cd252916e1a..d0a6e8e022a2 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -680,11 +680,10 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp) { lockdep_assert_held(&state_lock); - if (!fp->fi_lease) + if (!fp->fi_deleg_file) return; if (atomic_dec_and_test(&fp->fi_delegees)) { vfs_setlease(fp->fi_deleg_file, F_UNLCK, NULL); - fp->fi_lease = NULL; fput(fp->fi_deleg_file); fp->fi_deleg_file = NULL; } @@ -3061,8 +3060,8 @@ static void nfsd4_init_file(struct nfs4_file *fp, struct knfsd_fh *fh) INIT_LIST_HEAD(&fp->fi_stateids); INIT_LIST_HEAD(&fp->fi_delegations); fh_copy_shallow(&fp->fi_fhandle, fh); + fp->fi_deleg_file = NULL; fp->fi_had_conflict = false; - fp->fi_lease = NULL; fp->fi_share_deny = 0; memset(fp->fi_fds, 0, sizeof(fp->fi_fds)); memset(fp->fi_access, 0, sizeof(fp->fi_access)); @@ -3803,13 +3802,12 @@ static int nfs4_setlease(struct nfs4_delegation *dp) if (fp->fi_had_conflict) goto out_unlock; /* Race breaker */ - if (fp->fi_lease) { + if (fp->fi_deleg_file) { status = 0; atomic_inc(&fp->fi_delegees); hash_delegation_locked(dp, fp); goto out_unlock; } - fp->fi_lease = fl; fp->fi_deleg_file = filp; atomic_set(&fp->fi_delegees, 1); hash_delegation_locked(dp, fp); @@ -3842,7 +3840,7 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, spin_lock(&state_lock); spin_lock(&fp->fi_lock); dp->dl_stid.sc_file = fp; - if (!fp->fi_lease) { + if (!fp->fi_deleg_file) { spin_unlock(&fp->fi_lock); spin_unlock(&state_lock); status = nfs4_setlease(dp); diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 4a89e00d7461..64f291a25a8c 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -477,7 +477,6 @@ struct nfs4_file { atomic_t fi_access[2]; u32 fi_share_deny; struct file *fi_deleg_file; - struct file_lock *fi_lease; atomic_t fi_delegees; struct knfsd_fh fi_fhandle; bool fi_had_conflict;