summaryrefslogtreecommitdiffstats
path: root/fs/lockd/host.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-04 11:16:15 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 16:55:20 +0200
commit6b54dae2b0defb30babb0fe87b13463b9f4b2907 (patch)
tree0a9e2d34f4fb089287b6d5b92cb438b30dd66293 /fs/lockd/host.c
parent[PATCH] knfsd: nfsd4: acls: fix handling of zero-length acls (diff)
downloadlinux-6b54dae2b0defb30babb0fe87b13463b9f4b2907.tar.xz
linux-6b54dae2b0defb30babb0fe87b13463b9f4b2907.zip
[PATCH] knfsd: lockd: fix refount on nsm
If nlm_lookup_host finds what it is looking for it exits with an extra reference on the matching 'nsm' structure. So don't actually count the reference until we are (fairly) sure it is going to be used. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/lockd/host.c')
-rw-r--r--fs/lockd/host.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 0257a5594524..fb24a9730345 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -103,8 +103,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
continue;
/* See if we have an NSM handle for this client */
- if (!nsm && (nsm = host->h_nsmhandle) != 0)
- atomic_inc(&nsm->sm_count);
+ if (!nsm)
+ nsm = host->h_nsmhandle;
if (host->h_proto != proto)
continue;
@@ -120,6 +120,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
nlm_get_host(host);
goto out;
}
+ if (nsm)
+ atomic_inc(&nsm->sm_count);
host = NULL;