[PATCH] pcmcia/cs: fix possible missed wakeup
Andrew Morton
akpm at osdl.org
Wed Aug 17 19:06:02 EDT 2005
Daniel Ritz <daniel.ritz at gmx.ch> wrote:
>
> hi andrew, dominik, andreas
>
> the patch fixes one of the problems andreas steinmetz reported a while ago.
> akmp, please queue up in -mm, andreas please test. should fix the last
> testcase in your test script:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=112293392628128&w=4
>
Did we hear back on the testing results of this one?
Thanks.
>
> [PATCH] pcmcia/cs: fix possible missed wakeup
>
> - thread_done should only be completed when the wait_queue is installed.
> - all wake up conditions should be checked before schedule()
>
> this fixes a hang of rmmod in the sequence modprobe yenta_socket; rmmod yenta_socket
> as reported by Andreas Steinmetz. w/o this rmmod yenta_socket can hang on
> wait_for_completion() in pcmcia_unregister_socket()
>
> Signed-off-by: Daniel Ritz <daniel.ritz at gmx.ch>
>
> diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
> --- a/drivers/pcmcia/cs.c
> +++ b/drivers/pcmcia/cs.c
> @@ -654,9 +654,10 @@ static int pccardd(void *__skt)
> skt->thread = NULL;
> complete_and_exit(&skt->thread_done, 0);
> }
> - complete(&skt->thread_done);
>
> add_wait_queue(&skt->thread_wait, &wait);
> + complete(&skt->thread_done);
> +
> for (;;) {
> unsigned long flags;
> unsigned int events;
> @@ -682,11 +683,11 @@ static int pccardd(void *__skt)
> continue;
> }
>
> - schedule();
> - try_to_freeze();
> -
> if (!skt->thread)
> break;
> +
> + schedule();
> + try_to_freeze();
> }
> remove_wait_queue(&skt->thread_wait, &wait);
>
More information about the linux-pcmcia
mailing list