From 47121d720c2dbcf76d140ab26855bdbf9a83fff6 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Sat, 7 Aug 2010 09:21:41 -0400 Subject: [PATCH] --- yaml --- r: 206455 b: refs/heads/master c: 998db52c03cd293d16a457f1b396cea932244147 h: refs/heads/master i: 206453: 0e6b0e38323f87d1a5d1658eb407b14a6136654c 206451: ba4b41cd18e4700731003feadd5e2e7b42243787 206447: 6a34860397f9452fb0f2c016f34e40dc912524ac v: v3 --- [refs] | 2 +- trunk/fs/nfsd/nfs4state.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 9da1db409919..40a6918716b7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7fa53cc872332b265bc5ba1266f39586f218ad4a +refs/heads/master: 998db52c03cd293d16a457f1b396cea932244147 diff --git a/trunk/fs/nfsd/nfs4state.c b/trunk/fs/nfsd/nfs4state.c index 0b4351f8238a..0a024917f052 100644 --- a/trunk/fs/nfsd/nfs4state.c +++ b/trunk/fs/nfsd/nfs4state.c @@ -162,13 +162,22 @@ static struct list_head ownerstr_hashtbl[OWNER_HASH_SIZE]; static struct list_head file_hashtbl[FILE_HASH_SIZE]; static struct list_head stateid_hashtbl[STATEID_HASH_SIZE]; -static inline void nfs4_file_get_access(struct nfs4_file *fp, int oflag) +static void __nfs4_file_get_access(struct nfs4_file *fp, int oflag) { BUG_ON(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR])); atomic_inc(&fp->fi_access[oflag]); } -static inline void nfs4_file_put_fd(struct nfs4_file *fp, int oflag) +static void nfs4_file_get_access(struct nfs4_file *fp, int oflag) +{ + if (oflag == O_RDWR) { + __nfs4_file_get_access(fp, O_RDONLY); + __nfs4_file_get_access(fp, O_WRONLY); + } else + __nfs4_file_get_access(fp, oflag); +} + +static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag) { if (fp->fi_fds[oflag]) { fput(fp->fi_fds[oflag]); @@ -176,7 +185,7 @@ static inline void nfs4_file_put_fd(struct nfs4_file *fp, int oflag) } } -static inline void nfs4_file_put_access(struct nfs4_file *fp, int oflag) +static void __nfs4_file_put_access(struct nfs4_file *fp, int oflag) { if (atomic_dec_and_test(&fp->fi_access[oflag])) { nfs4_file_put_fd(fp, O_RDWR); @@ -184,6 +193,15 @@ static inline void nfs4_file_put_access(struct nfs4_file *fp, int oflag) } } +static void nfs4_file_put_access(struct nfs4_file *fp, int oflag) +{ + if (oflag == O_RDWR) { + __nfs4_file_put_access(fp, O_RDONLY); + __nfs4_file_put_access(fp, O_WRONLY); + } else + __nfs4_file_put_access(fp, oflag); +} + static struct nfs4_delegation * alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_fh *current_fh, u32 type) {