diff options
| author | Jeff Layton <jlayton@redhat.com> | 2008-02-06 11:34:13 -0500 |
|---|---|---|
| committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-02-10 18:09:36 -0500 |
| commit | c64e80d55db81df22a7f25b75ab4ba4c55db4749 (patch) | |
| tree | bc844c9fbc4a19887b108d457f0d8fdc651630e2 | |
| parent | 9706501e43a80ce48b319214a0a9e562deded35b (diff) | |
NLM: don't requeue block if it was invalidated while GRANT_MSG was in 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>
| -rw-r--r-- | fs/lockd/svclock.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 82db7b323b83..fe9bdb4a220c 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
| @@ -795,6 +795,17 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data) | |||
| 795 | 795 | ||
| 796 | dprintk("lockd: GRANT_MSG RPC callback\n"); | 796 | dprintk("lockd: GRANT_MSG RPC callback\n"); |
| 797 | 797 | ||
| 798 | /* if the block is not on a list at this point then it has | ||
| 799 | * been invalidated. Don't try to requeue it. | ||
| 800 | * | ||
| 801 | * FIXME: it's possible that the block is removed from the list | ||
| 802 | * after this check but before the nlmsvc_insert_block. In that | ||
| 803 | * case it will be added back. Perhaps we need better locking | ||
| 804 | * for nlm_blocked? | ||
| 805 | */ | ||
| 806 | if (list_empty(&block->b_list)) | ||
| 807 | return; | ||
| 808 | |||
| 798 | /* Technically, we should down the file semaphore here. Since we | 809 | /* Technically, we should down the file semaphore here. Since we |
| 799 | * move the block towards the head of the queue only, no harm | 810 | * move the block towards the head of the queue only, no harm |
| 800 | * can be done, though. */ | 811 | * can be done, though. */ |
