Re: segfault when unloading module loop in 2.6.0-test3+ck patches

From: Andrew Morton
Date: Sun Aug 17 2003 - 16:38:53 EST


Peter Osterlund <petero2@xxxxxxxxx> wrote:
>
> Andrew Morton <akpm@xxxxxxxx> writes:
>
> > Peter Osterlund <petero2@xxxxxxxxx> wrote:
> > >
> > > diff -puN drivers/block/loop.c~loop-oops-fix drivers/block/loop.c
> > > --- linux/drivers/block/loop.c~loop-oops-fix 2003-08-17 19:19:22.000000000 +0200
> > > +++ linux-petero/drivers/block/loop.c 2003-08-17 20:33:03.000000000 +0200
> > > @@ -1198,6 +1198,7 @@ int __init loop_init(void)
> > > lo->lo_queue = blk_alloc_queue(GFP_KERNEL);
> > > if (!lo->lo_queue)
> > > goto out_mem4;
> > > + init_timer(&lo->lo_queue->unplug_timer);
> > > disks[i]->queue = lo->lo_queue;
> > > init_MUTEX(&lo->lo_ctl_mutex);
> > > init_MUTEX_LOCKED(&lo->lo_sem);
> >
> > This bit should be done in ll_rw_blk.c somewhere. Are you sure it is
> > necessary for loop?
>
> Without this, if I insmod loop and then immediately rmmod loop,
> del_timer() calls check_timer_failed(), which generates warnings in
> the kernel log.
>
> In normal cases, the timer is initialized in blk_queue_make_request(),
> but that function is not called if you don't use the loop device
> before unloading the module. Maybe there is a better way to get rid of
> this warning.

Yup. I moved it to blk_alloc_queue() and removed the init_timer() from
blk_queue_make_request().

-
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/