[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200811221247.44558.knikanth@suse.de>
Date: Sat, 22 Nov 2008 12:47:44 +0530
From: Nikanth Karthikesan <knikanth@...e.de>
To: Jens Axboe <jens.axboe@...cle.com>
Cc: linux-kernel@...r.kernel.org, Fabio Checconi <fchecconi@...il.com>
Subject: Re: [PATCH] Exiting queue and task might race to free cic
Hi Jens
On Thursday 20 November 2008 10:27:06 Nikanth Karthikesan wrote:
> On Wednesday 19 November 2008 19:45:31 Jens Axboe wrote:
> > On Wed, Nov 19 2008, Nikanth Karthikesan wrote:
> >
> > Not sure this is enough, we probably need to copy the key to ensure that
> > we get a fresh value. How does this look?
>
> Agreed. Read barrier required. But the compiler hint, "likely" can stay?
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index 6a062ee..4504b94 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -1318,7 +1318,15 @@ static void cfq_exit_single_io_context(struct
> io_context *ioc,
> unsigned long flags;
>
> spin_lock_irqsave(q->queue_lock, flags);
> - __cfq_exit_single_io_context(cfqd, cic);
> +
> + /*
> + * Ensure we get a fresh copy of the ->key to prevent
> + * race between exiting task and queue
> + */
> + smp_read_barrier_depends();
> + if (likely(cic->key))
> + __cfq_exit_single_io_context(cfqd, cic);
> +
> spin_unlock_irqrestore(q->queue_lock, flags);
> }
> }
>
> > Did you actually trigger this, or is it just from code inspection?
>
> No. But I am looking at another bug report on Suse Kernel where the bug is
> triggered during reboot when the kernel thread usb_stor_scan_thread exits.
>
This patch seems to solve the above said bug report on Suse kernel. So, yes it
is reproducible! Can this be merged?
Thanks
Nikanth
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists