Skip to content

Commit 36943fa

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
NLM: nlm_alloc_call should not immediately fail on signal
Currently, nlm_alloc_call tests for a signal before it even tries to allocate memory. Fix it so that it tries at least once. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 47831f3 commit 36943fa

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎fs/lockd/clntproc.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,15 @@ nlmclnt_alloc_call(void)
291291
{
292292
struct nlm_rqst *call;
293293

294-
while (!signalled()) {
295-
call = (struct nlm_rqst *) kmalloc(sizeof(struct nlm_rqst), GFP_KERNEL);
296-
if (call) {
297-
memset(call, 0, sizeof(*call));
294+
for(;;) {
295+
call = kzalloc(sizeof(*call), GFP_KERNEL);
296+
if (call != NULL) {
298297
locks_init_lock(&call->a_args.lock.fl);
299298
locks_init_lock(&call->a_res.lock.fl);
300299
return call;
301300
}
301+
if (signalled())
302+
break;
302303
printk("nlmclnt_alloc_call: failed, waiting for memory\n");
303304
schedule_timeout_interruptible(5*HZ);
304305
}

0 commit comments

Comments
 (0)