From: "J. Bruce Fields" <bfields@fieldses.org>
To: linux-nfs@vger.kernel.org
Cc: Harshula Jayasuriya <harshula@redhat.com>
Subject: [PATCH] Revert "nfsd: nfs4_file_get_access: need to be more careful with O_RDWR"
Date: Fri, 30 Aug 2013 17:30:27 -0400 [thread overview]
Message-ID: <20130830213027.GA32015@fieldses.org> (raw)
From: "J. Bruce Fields" <bfields@redhat.com>
This reverts commit df66e75395c839c3a373bae897dbb1248f741b45.
nfsd4_lock can get a read-only or write-only reference when only a
read-write open is available. This is normal.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfs4state.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 5e609b1..eb9cf81 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -282,14 +282,19 @@ static unsigned int file_hashval(struct inode *ino)
static struct hlist_head file_hashtbl[FILE_HASH_SIZE];
+static void __nfs4_file_get_access(struct nfs4_file *fp, int oflag)
+{
+ WARN_ON_ONCE(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR]));
+ atomic_inc(&fp->fi_access[oflag]);
+}
+
static void nfs4_file_get_access(struct nfs4_file *fp, int oflag)
{
- WARN_ON_ONCE(!fp->fi_fds[oflag]);
if (oflag == O_RDWR) {
- atomic_inc(&fp->fi_access[O_RDONLY]);
- atomic_inc(&fp->fi_access[O_WRONLY]);
+ __nfs4_file_get_access(fp, O_RDONLY);
+ __nfs4_file_get_access(fp, O_WRONLY);
} else
- atomic_inc(&fp->fi_access[oflag]);
+ __nfs4_file_get_access(fp, oflag);
}
static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag)
--
1.7.9.5
reply other threads:[~2013-08-30 21:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20130830213027.GA32015@fieldses.org \
--to=bfields@fieldses.org \
--cc=harshula@redhat.com \
--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).