[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <165590733080.75778.16386422015870544314.stgit@manet.1015granger.net>
Date: Wed, 22 Jun 2022 10:15:30 -0400
From: Chuck Lever <chuck.lever@...cle.com>
To: linux-nfs@...r.kernel.org, netdev@...r.kernel.org
Cc: david@...morbit.com, tgraf@...g.ch, jlayton@...hat.com
Subject: [PATCH RFC 25/30] NFSD: Clean up "open file" case in
nfsd_file_acquire()
Refactor a little to prepare for changes to nfsd_file_find_locked().
Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
---
fs/nfsd/filecache.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index ae813e6f645f..8b8d765a0df0 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -1003,23 +1003,22 @@ nfsd_do_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
rcu_read_lock();
nf = nfsd_file_find_locked(inode, may_flags, hashval, net);
rcu_read_unlock();
- if (nf)
- goto wait_for_construction;
+ if (nf == NULL) {
+ new = nfsd_file_alloc(inode, may_flags, net);
+ if (!new) {
+ status = nfserr_jukebox;
+ goto out_status;
+ }
- new = nfsd_file_alloc(inode, may_flags, net);
- if (!new) {
- status = nfserr_jukebox;
- goto out_status;
- }
+ spin_lock(&nfsd_file_hashtbl[hashval].nfb_lock);
+ nf = nfsd_file_find_locked(inode, may_flags, hashval, net);
+ if (nf == NULL)
+ goto open_file;
+ spin_unlock(&nfsd_file_hashtbl[hashval].nfb_lock);
- spin_lock(&nfsd_file_hashtbl[hashval].nfb_lock);
- nf = nfsd_file_find_locked(inode, may_flags, hashval, net);
- if (nf == NULL)
- goto open_file;
- spin_unlock(&nfsd_file_hashtbl[hashval].nfb_lock);
- nfsd_file_slab_free(&new->nf_rcu);
+ nfsd_file_slab_free(&new->nf_rcu);
+ }
-wait_for_construction:
wait_on_bit(&nf->nf_flags, NFSD_FILE_PENDING, TASK_UNINTERRUPTIBLE);
/* Did construction of this file fail? */
Powered by blists - more mailing lists