Skip to contentSkip to conversation

Revert "nfsd: nfs4_file_get_access: need to be more careful with O_RDWR"

PATCH New J. Bruce Fields 1 participant 1 message Aug 30, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "nfsd: nfs4_file_get_access: need to be more careful with O_RDWR"

From: "J. Bruce Fields" <[email protected]>

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.

---
 fs/nfsd/nfs4state.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
fs/nfsd/nfs4state.c +9 -4
index 5e609b1..eb9cf81 100644
@@ -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)
Signature · 1 line
1.7.9.5