Commit ecf6c748 authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Greg Kroah-Hartman

nfsd4: remember to put RW access on stateid destruction

commit 499f3edc upstream.

Without this, for example,

	open read
	open read+write
	close

will result in a struct file leak.

Regression from 7d947842 "nfsd4: fix
downgrade/lock logic".
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f6d7de0e
...@@ -381,14 +381,6 @@ static int nfs4_access_to_omode(u32 access) ...@@ -381,14 +381,6 @@ static int nfs4_access_to_omode(u32 access)
BUG(); BUG();
} }
static int nfs4_access_bmap_to_omode(struct nfs4_stateid *stp)
{
unsigned int access;
set_access(&access, stp->st_access_bmap);
return nfs4_access_to_omode(access);
}
static void unhash_generic_stateid(struct nfs4_stateid *stp) static void unhash_generic_stateid(struct nfs4_stateid *stp)
{ {
list_del(&stp->st_hash); list_del(&stp->st_hash);
...@@ -398,11 +390,14 @@ static void unhash_generic_stateid(struct nfs4_stateid *stp) ...@@ -398,11 +390,14 @@ static void unhash_generic_stateid(struct nfs4_stateid *stp)
static void free_generic_stateid(struct nfs4_stateid *stp) static void free_generic_stateid(struct nfs4_stateid *stp)
{ {
int oflag; int i;
if (stp->st_access_bmap) { if (stp->st_access_bmap) {
oflag = nfs4_access_bmap_to_omode(stp); for (i = 1; i < 4; i++) {
nfs4_file_put_access(stp->st_file, oflag); if (test_bit(i, &stp->st_access_bmap))
nfs4_file_put_access(stp->st_file,
nfs4_access_to_omode(i));
}
} }
put_nfs4_file(stp->st_file); put_nfs4_file(stp->st_file);
kmem_cache_free(stateid_slab, stp); kmem_cache_free(stateid_slab, stp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment