From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jlayton@primarydata.com>
Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 07/17] nfsd: don't keep a pointer to the lease in nfs4_file
Date: Fri, 5 Sep 2014 17:40:58 -0400 [thread overview]
Message-ID: <20140905214058.GA5443@fieldses.org> (raw)
In-Reply-To: <1409834323-7171-8-git-send-email-jlayton@primarydata.com>
On Thu, Sep 04, 2014 at 08:38:33AM -0400, Jeff Layton wrote:
> 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 <bfields@fieldses.org>
> Signed-off-by: Jeff Layton <jlayton@primarydata.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
> 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;
> }
Note the code in my for-3.18 branch is different here due to a couple
patches I've already taken from you.
--b.
> @@ -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;
> --
> 1.9.3
>
next prev parent reply other threads:[~2014-09-05 21:41 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 12:38 [PATCH v2 00/17] locks: internal lease API overhaul Jeff Layton
2014-09-04 12:38 ` [PATCH v2 01/17] locks: consolidate "nolease" routines Jeff Layton
2014-09-04 12:41 ` Trond Myklebust
2014-09-04 12:49 ` Jeff Layton
2014-09-04 18:25 ` Trond Myklebust
2014-09-04 20:12 ` Christoph Hellwig
2014-09-05 11:48 ` Jeff Layton
2014-09-04 17:46 ` Christoph Hellwig
2014-09-04 12:38 ` [PATCH v2 02/17] security: make security_file_set_fowner, f_setown and __f_setown void return Jeff Layton
2014-09-04 17:47 ` Christoph Hellwig
2014-10-07 17:11 ` Dmitry Kasatkin
2014-10-07 17:17 ` Christoph Hellwig
2014-10-07 17:34 ` Dmitry Kasatkin
2014-10-07 18:02 ` Jeff Layton
2014-09-04 12:38 ` [PATCH v2 03/17] locks: close potential race in lease_get_mtime Jeff Layton
2014-09-04 12:38 ` [PATCH v2 04/17] nfsd: fix potential lease memory leak in nfs4_setlease Jeff Layton
2014-09-04 12:38 ` [PATCH v2 05/17] locks: generic_delete_lease doesn't need a file_lock at all Jeff Layton
2014-09-04 20:14 ` Christoph Hellwig
2014-09-05 0:29 ` Jeff Layton
2015-01-12 23:03 ` NeilBrown
2015-01-12 23:25 ` Jeff Layton
2015-01-13 2:14 ` NeilBrown
2014-09-04 12:38 ` [PATCH v2 06/17] locks: clean up vfs_setlease kerneldoc comments Jeff Layton
2014-09-04 12:38 ` [PATCH v2 07/17] nfsd: don't keep a pointer to the lease in nfs4_file Jeff Layton
2014-09-05 21:40 ` J. Bruce Fields [this message]
2014-09-06 12:33 ` Jeff Layton
2014-09-04 12:38 ` [PATCH v2 08/17] locks: plumb a "priv" pointer into the setlease routines Jeff Layton
2014-09-04 17:48 ` Christoph Hellwig
2014-09-04 12:38 ` [PATCH v2 09/17] locks: define a lm_setup handler for leases Jeff Layton
2014-09-04 17:49 ` Christoph Hellwig
2014-09-04 12:38 ` [PATCH v2 10/17] locks: move i_lock acquisition into generic_*_lease handlers Jeff Layton
2014-09-04 12:38 ` [PATCH v2 11/17] locks: move freeing of leases outside of i_lock Jeff Layton
2014-09-04 17:50 ` Christoph Hellwig
2014-09-05 14:03 ` Jeff Layton
2014-09-04 12:38 ` [PATCH v2 12/17] locks: update Documentation/filesystems with new setlease semantics Jeff Layton
2014-09-04 17:50 ` Christoph Hellwig
2014-09-05 14:02 ` Jeff Layton
2014-09-04 12:38 ` [PATCH v2 13/17] locks: remove i_have_this_lease check from __break_lease Jeff Layton
2014-09-04 17:51 ` Christoph Hellwig
2014-09-04 18:03 ` Jeff Layton
2014-09-04 12:38 ` [PATCH v2 14/17] locks: __break_lease cleanup in preparation of allowing direct removal of leases Jeff Layton
2014-09-04 18:07 ` Christoph Hellwig
2014-09-05 13:35 ` Jeff Layton
2014-09-04 12:38 ` [PATCH v2 15/17] locks: give lm_break a return value Jeff Layton
2014-09-04 18:08 ` Christoph Hellwig
2014-09-04 12:38 ` [PATCH v2 16/17] locks: set fl_owner for leases to filp instead of current->files Jeff Layton
2014-09-04 12:38 ` [PATCH v2 17/17] locks: clean up comments over fl_owner_t definition Jeff Layton
2014-09-04 17:53 ` Christoph Hellwig
2014-09-05 13:36 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140905214058.GA5443@fieldses.org \
--to=bfields@fieldses.org \
--cc=hch@infradead.org \
--cc=jlayton@primarydata.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox