Skip to content

Commit

Permalink
NLM: don't requeue block if it was invalidated while GRANT_MSG was in…
Browse files Browse the repository at this point in the history
… flight

It's possible for lockd to catch a SIGKILL while a GRANT_MSG callback
is in flight. If this happens we don't want lockd to insert the block
back into the nlm_blocked list.

This helps that situation, but there's still a possible race. Fixing
that will mean adding real locking for nlm_blocked.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
  • Loading branch information
Jeff Layton authored and J. Bruce Fields committed Feb 10, 2008
1 parent 9706501 commit c64e80d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fs/lockd/svclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,17 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data)

dprintk("lockd: GRANT_MSG RPC callback\n");

/* if the block is not on a list at this point then it has
* been invalidated. Don't try to requeue it.
*
* FIXME: it's possible that the block is removed from the list
* after this check but before the nlmsvc_insert_block. In that
* case it will be added back. Perhaps we need better locking
* for nlm_blocked?
*/
if (list_empty(&block->b_list))
return;

/* Technically, we should down the file semaphore here. Since we
* move the block towards the head of the queue only, no harm
* can be done, though. */
Expand Down

0 comments on commit c64e80d

Please sign in to comment.