From: Jeff Layton <jlayton@primarydata.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 3/3] nfsd: allow find_any_file to return a fi_deleg_file reference
Date: Sat, 9 Aug 2014 10:22:42 -0400 [thread overview]
Message-ID: <1407594162-28342-4-git-send-email-jlayton@primarydata.com> (raw)
In-Reply-To: <1407594162-28342-1-git-send-email-jlayton@primarydata.com>
It's possible that we'll have a nfs4_file that has nothing in its fds
array, but that has a populated fi_deleg_file field. Since that function
is generally happy with any file reference, allow it to find and take
a reference to it in that situation. Also, clean up find_any_file for
better readability.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
fs/nfsd/nfs4state.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 4356d32479b2..5c5873811bd9 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -355,11 +355,20 @@ find_any_file(struct nfs4_file *f)
spin_lock(&f->fi_lock);
ret = __nfs4_get_fd(f, O_RDWR);
- if (!ret) {
- ret = __nfs4_get_fd(f, O_WRONLY);
- if (!ret)
- ret = __nfs4_get_fd(f, O_RDONLY);
- }
+ if (ret)
+ goto out;
+
+ ret = __nfs4_get_fd(f, O_WRONLY);
+ if (ret)
+ goto out;
+
+ ret = __nfs4_get_fd(f, O_RDONLY);
+ if (ret)
+ goto out;
+
+ if (f->fi_deleg_file)
+ ret = get_file(f->fi_deleg_file);
+out:
spin_unlock(&f->fi_lock);
return ret;
}
--
1.9.3
next prev parent reply other threads:[~2014-08-09 14:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-09 14:22 [PATCH 0/3] nfsd: lease handling cleanups Jeff Layton
2014-08-09 14:22 ` [PATCH 1/3] nfsd: protect lease-related nfs4_file fields with fi_lock Jeff Layton
2014-08-09 14:22 ` [PATCH 2/3] nfsd: call nfs4_put_deleg_lease outside of state_lock Jeff Layton
2014-08-09 14:22 ` Jeff Layton [this message]
2014-08-11 16:08 ` [PATCH 3/3] nfsd: allow find_any_file to return a fi_deleg_file reference J. Bruce Fields
2014-08-11 16:40 ` Jeff Layton
2014-08-11 17:09 ` J. Bruce Fields
2014-08-11 17:20 ` Jeff Layton
2014-08-11 17:41 ` J. Bruce Fields
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=1407594162-28342-4-git-send-email-jlayton@primarydata.com \
--to=jlayton@primarydata.com \
--cc=bfields@fieldses.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;
as well as URLs for NNTP newsgroup(s).