Commit e7b2033159b6e12240af8b4a543e955dbd3cade3
Committed by
Greg Kroah-Hartman
1 parent
90293ffa75
LOCKD: Fix a race when initialising nlmsvc_timeout
commit 06bed7d18c2c07b3e3eeadf4bd357f6e806618cc upstream. This commit fixes a race whereby nlmclnt_init() first starts the lockd daemon, and then calls nlm_bind_host() with the expectation that nlmsvc_timeout has already been initialised. Unfortunately, there is no no synchronisation between lockd() and lockd_up() to guarantee that this is the case. Fix is to move the initialisation of nlmsvc_timeout into lockd_create_svc Fixes: 9a1b6bf818e74 ("LOCKD: Don't call utsname()->nodename...") Cc: Bruce Fields <bfields@fieldses.org> Cc: stable@vger.kernel.org # 3.10.x Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
fs/lockd/svc.c
... | ... | @@ -138,10 +138,6 @@ |
138 | 138 | |
139 | 139 | dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n"); |
140 | 140 | |
141 | - if (!nlm_timeout) | |
142 | - nlm_timeout = LOCKD_DFLT_TIMEO; | |
143 | - nlmsvc_timeout = nlm_timeout * HZ; | |
144 | - | |
145 | 141 | /* |
146 | 142 | * The main request loop. We don't terminate until the last |
147 | 143 | * NFS mount or NFS daemon has gone away. |
... | ... | @@ -349,6 +345,10 @@ |
349 | 345 | if (nlmsvc_users) |
350 | 346 | printk(KERN_WARNING |
351 | 347 | "lockd_up: no pid, %d users??\n", nlmsvc_users); |
348 | + | |
349 | + if (!nlm_timeout) | |
350 | + nlm_timeout = LOCKD_DFLT_TIMEO; | |
351 | + nlmsvc_timeout = nlm_timeout * HZ; | |
352 | 352 | |
353 | 353 | serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, NULL); |
354 | 354 | if (!serv) { |