All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Dirk Henning Gerdes <mail@dirk-gerdes.de>
Cc: Tejun Heo <htejun@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH linux-2.6-14-mm2] block: problem unloading I/O-Scheduler Module
Date: Thu, 17 Nov 2005 14:46:32 +0100	[thread overview]
Message-ID: <20051117134632.GJ7787@suse.de> (raw)
In-Reply-To: <1132234464.4856.12.camel@localhost.localdomain>

On Thu, Nov 17 2005, Dirk Henning Gerdes wrote:
> If you have compiled an I/O-Scheduler as module you cannot unload it,
> because of a memory-error.
> 
> Signed-off-by: Dirk Gerdes mail@dirk-gerdes.de
> 
> --- linux-2.6.14-mm2-pagecache/block/elevator.c	2005-11-17
> 12:37:10.000000000 +0100
> +++ linux-2.6.14-mm2-pagecache_fix/block/elevator.c	2005-11-17
> 14:05:41.000000000 +0100
> @@ -656,7 +656,7 @@
>  		struct io_context *ioc = p->io_context;
>  		struct cfq_io_context *cic;
>  
> -		if (ioc->cic_root.rb_node != NULL) {
> +		if (ioc != NULL && ioc->cic_root.rb_node != NULL) {
>  			cic = rb_entry(rb_first(&ioc->cic_root), struct cfq_io_context,
> rb_node);
>  			cic->exit(ioc);
>  			cic->dtor(ioc);

Shouldn't that just read

        if (!ioc)
                continue;

instead? Otherwise you'd crash on 'as' exit next. Ah, it already has
that. Ok, so I prefer this (what I merged).


diff --git a/block/elevator.c b/block/elevator.c
index 5720409..0c389a0 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -652,13 +652,16 @@ void elv_unregister(struct elevator_type
 		struct io_context *ioc = p->io_context;
 		struct cfq_io_context *cic;
 
+		if (!ioc)
+			continue;
+
 		if (ioc->cic_root.rb_node != NULL) {
 			cic = rb_entry(rb_first(&ioc->cic_root), struct cfq_io_context, rb_node);
 			cic->exit(ioc);
 			cic->dtor(ioc);
 		}
 
-		if (ioc && ioc->aic) {
+		if (ioc->aic) {
 			ioc->aic->exit(ioc->aic);
 			ioc->aic->dtor(ioc->aic);
 			ioc->aic = NULL;

-- 
Jens Axboe


  reply	other threads:[~2005-11-17 13:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-19 12:35 [PATCH linux-2.6-block:master 00/05] blk: generic dispatch queue Tejun Heo
2005-10-19 12:35 ` [PATCH linux-2.6-block:master 01/05] blk: implement " Tejun Heo
2005-10-20 10:00   ` Jens Axboe
2005-10-20 13:45     ` Tejun Heo
2005-10-20 14:04       ` Jens Axboe
2005-10-20 14:19         ` Tejun Heo
2005-10-19 12:35 ` [PATCH linux-2.6-block:master 02/05] blk: update ioscheds to use " Tejun Heo
2005-10-20 11:21   ` Jens Axboe
2005-10-20 13:51     ` Tejun Heo
2005-10-20 14:11       ` Jens Axboe
2005-10-20 14:35         ` Tejun Heo
2005-10-20 14:41           ` Jens Axboe
2005-10-20 15:00             ` Tejun Heo
2005-10-20 17:07               ` Jens Axboe
2005-10-20 17:31                 ` Tejun Heo
2005-11-17 13:34               ` [PATCH linux-2.6-14-mm2] block: problem unloading I/O-Scheduler Module Dirk Henning Gerdes
2005-11-17 13:46                 ` Jens Axboe [this message]
2005-10-19 12:35 ` [PATCH linux-2.6-block:master 03/05] blk: move last_merge handling into generic elevator code Tejun Heo
2005-10-20 11:26   ` Jens Axboe
2005-10-19 12:35 ` [PATCH linux-2.6-block:master 04/05] blk: remove last_merge handling from ioscheds Tejun Heo
2005-10-20 11:26   ` Jens Axboe
2005-10-19 12:35 ` [PATCH linux-2.6-block:master 05/05] blk: update biodoc Tejun Heo
2005-10-20 11:27   ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051117134632.GJ7787@suse.de \
    --to=axboe@suse.de \
    --cc=htejun@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@dirk-gerdes.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.