diff options
author | Jens Axboe <axboe@suse.de> | 2006-06-08 08:49:06 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-08 15:14:23 -0700 |
commit | bc1c116974a5c3f498112a6f175d3e4a8cd5bdbc (patch) | |
tree | 69ea68db91fb871cd24a0a5c5045abbe9c77bd3a /block/noop-iosched.c | |
parent | 26e780e8ef1cc3ef581a07aafe2346bb5a07b4f9 (diff) | |
download | linux-bc1c116974a5c3f498112a6f175d3e4a8cd5bdbc.tar.gz linux-bc1c116974a5c3f498112a6f175d3e4a8cd5bdbc.tar.bz2 linux-bc1c116974a5c3f498112a6f175d3e4a8cd5bdbc.zip |
[PATCH] elevator switching race
There's a race between shutting down one io scheduler and firing up the
next, in which a new io could enter and cause the io scheduler to be
invoked with bad or NULL data.
To fix this, we need to maintain the queue lock for a bit longer.
Unfortunately we cannot do that, since the elevator init requires to be
run without the lock held. This isn't easily fixable, without also
changing the mempool API. So split the initialization into two parts,
and alloc-init operation and an attach operation. Then we can
preallocate the io scheduler and related structures, and run the attach
inside the lock after we detach the old one.
This patch has survived 30 minutes of 1 second io scheduler switching
with a very busy io load.
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'block/noop-iosched.c')
-rw-r--r-- | block/noop-iosched.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/block/noop-iosched.c b/block/noop-iosched.c index f370e4a7fe6d..56a7c620574f 100644 --- a/block/noop-iosched.c +++ b/block/noop-iosched.c @@ -65,16 +65,15 @@ noop_latter_request(request_queue_t *q, struct request *rq) return list_entry(rq->queuelist.next, struct request, queuelist); } -static int noop_init_queue(request_queue_t *q, elevator_t *e) +static void *noop_init_queue(request_queue_t *q, elevator_t *e) { struct noop_data *nd; nd = kmalloc(sizeof(*nd), GFP_KERNEL); if (!nd) - return -ENOMEM; + return NULL; INIT_LIST_HEAD(&nd->queue); - e->elevator_data = nd; - return 0; + return nd; } static void noop_exit_queue(elevator_t *e) |