diff mbox

ide: fix memory leak when flush command is issued

Message ID 1247761972.8418.46.camel@sakura.staff.proxad.net
State Accepted
Delegated to: David Miller
Headers show

Commit Message

Maxime Bizon July 16, 2009, 4:32 p.m. UTC
Hi David, Bartlomiej

I'm using ide on 2.6.30.1 with xfs filesystem. I noticed a kernel memory
leak after writing lots of data, the kmalloc-96 slab cache keeps
growing. It seems the struct ide_cmd kmalloced by idedisk_prepare_flush
is never kfreed.

Commit a09485df9cda49fbde2766c86eb18a9cae585162 and
f505d49ffd25ed062e76ffd17568d3937fcd338c cause this regression, cmd->rq
must now be set for ide_complete_cmd to honor the IDE_TFLAG_DYN flag.

Candidate for stable I think, thanks !

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>

Comments

Bartlomiej Zolnierkiewicz July 17, 2009, 2:05 p.m. UTC | #1
On Thursday 16 July 2009 18:32:52 Maxime Bizon wrote:
> 
> Hi David, Bartlomiej
> 
> I'm using ide on 2.6.30.1 with xfs filesystem. I noticed a kernel memory
> leak after writing lots of data, the kmalloc-96 slab cache keeps
> growing. It seems the struct ide_cmd kmalloced by idedisk_prepare_flush
> is never kfreed.
> 
> Commit a09485df9cda49fbde2766c86eb18a9cae585162 and
> f505d49ffd25ed062e76ffd17568d3937fcd338c cause this regression, cmd->rq
> must now be set for ide_complete_cmd to honor the IDE_TFLAG_DYN flag.
> 
> Candidate for stable I think, thanks !
> 
> Signed-off-by: Maxime Bizon <mbizon@freebox.fr>

Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Thanks for fixing this!

> diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
> index 6951811..7f87801 100644
> --- a/drivers/ide/ide-disk.c
> +++ b/drivers/ide/ide-disk.c
> @@ -455,6 +455,7 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
>  
>  	rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
>  	rq->special = cmd;
> +	cmd->rq = rq;
>  }
>  
>  ide_devset_get(multcount, mult_count);
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller July 22, 2009, 3:25 a.m. UTC | #2
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Date: Fri, 17 Jul 2009 16:05:54 +0200

> On Thursday 16 July 2009 18:32:52 Maxime Bizon wrote:
>> 
>> Hi David, Bartlomiej
>> 
>> I'm using ide on 2.6.30.1 with xfs filesystem. I noticed a kernel memory
>> leak after writing lots of data, the kmalloc-96 slab cache keeps
>> growing. It seems the struct ide_cmd kmalloced by idedisk_prepare_flush
>> is never kfreed.
>> 
>> Commit a09485df9cda49fbde2766c86eb18a9cae585162 and
>> f505d49ffd25ed062e76ffd17568d3937fcd338c cause this regression, cmd->rq
>> must now be set for ide_complete_cmd to honor the IDE_TFLAG_DYN flag.
>> 
>> Candidate for stable I think, thanks !
>> 
>> Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
> 
> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 6951811..7f87801 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -455,6 +455,7 @@  static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
 
 	rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
 	rq->special = cmd;
+	cmd->rq = rq;
 }
 
 ide_devset_get(multcount, mult_count);