[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <x49fx1ea1q6.fsf@segfault.boston.devel.redhat.com>
Date: Wed, 26 May 2010 15:42:57 -0400
From: Jeff Moyer <jmoyer@...hat.com>
To: Shaohua Li <shaohua.li@...el.com>
Cc: linux-kernel@...r.kernel.org, jens.axboe@...cle.com
Subject: Re: [PATCH]cfq-iosched: fix an oops caused by slab leak
Shaohua Li <shaohua.li@...el.com> writes:
> I got below oops when unloading cfq-iosched. Considering scenario:
> queue A merge to B, C merge to D and B will be merged to D. Before B is merged
> to D, we do split B. We should put B's reference for D.
[...]
> Signed-off-by: Shaohua Li <shaohua.li@...el.com>
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index ed897b5..855fd5f 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -2537,15 +2537,10 @@ static void cfq_free_io_context(struct io_context *ioc)
> __call_for_each_cic(ioc, cic_free_func);
> }
>
> -static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
> +static void cfq_put_cooperator(struct cfq_queue *cfqq)
> {
> struct cfq_queue *__cfqq, *next;
>
> - if (unlikely(cfqq == cfqd->active_queue)) {
> - __cfq_slice_expired(cfqd, cfqq, 0);
> - cfq_schedule_dispatch(cfqd);
> - }
> -
> /*
> * If this queue was scheduled to merge with another queue, be
> * sure to drop the reference taken on that queue (and others in
> @@ -2561,6 +2556,16 @@ static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
> cfq_put_queue(__cfqq);
> __cfqq = next;
> }
> +}
> +
> +static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
> +{
> + if (unlikely(cfqq == cfqd->active_queue)) {
> + __cfq_slice_expired(cfqd, cfqq, 0);
> + cfq_schedule_dispatch(cfqd);
> + }
> +
> + cfq_put_cooperator(cfqq);
>
> cfq_put_queue(cfqq);
> }
> @@ -3516,6 +3521,9 @@ split_cfqq(struct cfq_io_context *cic, struct cfq_queue *cfqq)
> }
>
> cic_set_cfqq(cic, NULL, 1);
> +
> + cfq_put_cooperator(cfqq);
> +
> cfq_put_queue(cfqq);
> return NULL;
> }
Reviewed-by: Jeff Moyer <jmoyer@...hat.com>
--
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