Re: 3.0.3 kernel BUG at kernel/timer.c:1035

From: Frank van Maarseveen
Date: Tue Sep 20 2011 - 09:16:23 EST


On Wed, Sep 07, 2011 at 02:30:06PM -0700, Andrew Morton wrote:
> On Wed, 07 Sep 2011 20:36:19 +0800
> Lin Ming <ming.m.lin@xxxxxxxxx> wrote:
>
> > On Wed, 2011-09-07 at 18:24 +0800, Frank van Maarseveen wrote:
> > > On Tue, Sep 06, 2011 at 10:48:38PM +0800, Lin Ming wrote:
> > > > Does below patch help?
> > > >
> > > > >From a98b874437f871d5ecc3f6fe409b2b474b1f2731 Mon Sep 17 00:00:00 2001
> > > > From: Lin Ming <ming.m.lin@xxxxxxxxx>
> > > > Date: Tue, 6 Sep 2011 22:45:43 +0800
> > > > Subject: [PATCH] block: delete bdi writeback wakup_timer in blk_cleanup_queue()
> > > >
> > > > Signed-off-by: Lin Ming <ming.m.lin@xxxxxxxxx>
> > > > ---
> > > > block/blk-core.c | 1 +
> > > > 1 files changed, 1 insertions(+), 0 deletions(-)
> > > >
> > > > diff --git a/block/blk-core.c b/block/blk-core.c
> > > > index 90e1ffd..22529a3 100644
> > > > --- a/block/blk-core.c
> > > > +++ b/block/blk-core.c
> > > > @@ -363,6 +363,7 @@ void blk_cleanup_queue(struct request_queue *q)
> > > > blk_sync_queue(q);
> > > >
> > > > del_timer_sync(&q->backing_dev_info.laptop_mode_wb_timer);
> > > > + del_timer_sync(&q->backing_dev_info.wb.wakeup_timer);
> > > > mutex_lock(&q->sysfs_lock);
> > > > queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q);
> > > > mutex_unlock(&q->sysfs_lock);
> > > > --
> > > > 1.7.2.3
> > > >
> > >
> > > No, bug still present. Stack trace is the same and I double checked that
> > > it was the new kernel (this time with a lot more debug enabled).
> >
> > Thanks for test.
> > I'll try to reproduce this bug.
>
> Probably this will "fix" it:
>
> --- a/block/blk-sysfs.c~a
> +++ a/block/blk-sysfs.c
> @@ -4,6 +4,7 @@
> #include <linux/kernel.h>
> #include <linux/slab.h>
> #include <linux/module.h>
> +#include <linux/timer.h>
> #include <linux/bio.h>
> #include <linux/blkdev.h>
> #include <linux/blktrace_api.h>
> @@ -486,7 +487,7 @@ static void blk_release_queue(struct kob
> __blk_queue_free_tags(q);
>
> blk_trace_shutdown(q);
> -
> + del_timer_sync(&q->backing_dev_info.wb.wakeup_timer);
> bdi_destroy(&q->backing_dev_info);
> kmem_cache_free(blk_requestq_cachep, q);
> }
> _
>
> Jens, can you please take a look at this regression?
> blk_release_queue() is freeing a pending timer.

Yep, this fixes it. This is the recipe I used for triggering the issue
on 3.0.4 (it can probably be simplified):

- mount an ext[34] formatted USB stick read-write on /mnt, preloaded
with a (64k) file "bar" in subdirectory "foo".
- cat /mnt/foo/bar >/dev/null
- sleep 30 # or more
- unplug USB stick
- issue an "umount -l -f /mnt"

After playing with the 30 second delay parameter (to get more details) the
kernel somehow ended in a state where the bug was no longer reproducable.
A reboot made the recipe work again.


Thanks,

--
Frank
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/