diff options
author | NeilBrown <neilb@suse.de> | 2006-10-04 05:16:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 10:55:20 -0400 |
commit | 6b54dae2b0defb30babb0fe87b13463b9f4b2907 (patch) | |
tree | 0a9e2d34f4fb089287b6d5b92cb438b30dd66293 /fs/lockd/host.c | |
parent | b66285cee3f9abad26cca6c9b848e1ad6b792d94 (diff) |
[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.c | 6 |
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, | |||
103 | continue; | 103 | continue; |
104 | 104 | ||
105 | /* See if we have an NSM handle for this client */ | 105 | /* See if we have an NSM handle for this client */ |
106 | if (!nsm && (nsm = host->h_nsmhandle) != 0) | 106 | if (!nsm) |
107 | atomic_inc(&nsm->sm_count); | 107 | nsm = host->h_nsmhandle; |
108 | 108 | ||
109 | if (host->h_proto != proto) | 109 | if (host->h_proto != proto) |
110 | continue; | 110 | continue; |
@@ -120,6 +120,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin, | |||
120 | nlm_get_host(host); | 120 | nlm_get_host(host); |
121 | goto out; | 121 | goto out; |
122 | } | 122 | } |
123 | if (nsm) | ||
124 | atomic_inc(&nsm->sm_count); | ||
123 | 125 | ||
124 | host = NULL; | 126 | host = NULL; |
125 | 127 | ||