nfsd: nfs4_file_get_access: need to be more careful with O_RDWR
Subsystems (2)
PATCH 1/1 nfsd: nfs4_file_get_access: need to be more careful with O_RDWR
If fi_fds = {non-NULL, NULL, non-NULL} and oflag = O_WRONLY the WARN_ON_ONCE(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR])) doesn't trigger when it should.
Signed-off-by Harshula Jayasuriya <[email protected]>
--- fs/nfsd/nfs4state.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
fs/nfsd/nfs4state.c +4 -9
@@ -282,19 +282,14 @@ 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 ) { -__nfs4_file_get_access (fp,O_RDONLY ); -__nfs4_file_get_access (fp,O_WRONLY ); +atomic_inc (&fp->fi_access[O_RDONLY ]); +atomic_inc (&fp->fi_access[O_WRONLY ]); }else -__nfs4_file_get_access (fp, oflag); +atomic_inc (&fp->fi_access[oflag]); }static void nfs4_file_put_fd (struct nfs4_file *fp,int oflag)
Signature · 1 line
1.8.1.4
Thanks, applying for 3.12.--b.
Quoted 40 lines · Harshula Jayasuriya
If
fi_fds= {non-NULL, NULL, non-NULL} and oflag =O_WRONLYtheWARN_ON_ONCE(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR]))doesn't trigger when it should.Signed-off-by Harshula Jayasuriya <[email protected]>--- fs/nfsd/nfs4state.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)fs/nfsd/nfs4state.c +4
-9@@ -282,19 +282,14 @@ 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 ) { -__nfs4_file_get_access (fp,O_RDONLY ); -__nfs4_file_get_access (fp,O_WRONLY ); +atomic_inc (&fp->fi_access[O_RDONLY ]); +atomic_inc (&fp->fi_access[O_WRONLY ]); }else -__nfs4_file_get_access (fp, oflag); +atomic_inc (&fp->fi_access[oflag]); }static void nfs4_file_put_fd (struct nfs4_file *fp,int oflag)Signature · 1 line
1.8.1.4