Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1415945
| Path | csiph.com!goblin3!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Catalin Marinas <catalin.marinas@arm.com> |
| Newsgroups | linux.kernel |
| Subject | Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") |
| Date | Tue, 07 Jun 2016 11:50:02 +0200 |
| Message-ID | <rHlO2-109-15@gated-at.bofh.it> (permalink) |
| References | <rH0Tf-4eU-5@gated-at.bofh.it> <rH3xN-62c-69@gated-at.bofh.it> <rH5pT-7hl-31@gated-at.bofh.it> <rH6lY-7QH-39@gated-at.bofh.it> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 51 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Christoph Hellwig <hch@lst.de>, linux-block@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>, Jens Axboe <axboe@fb.com>, Larry.Finger@lwfinger.net, bart.vanassche@sandisk.com, drysdale@google.com |
| X-Original-Date | Tue, 7 Jun 2016 10:39:38 +0100 |
| X-Original-Message-ID | <20160607093937.GA7122@localhost> |
| X-Original-References | <20160606112620.GA29910@e104818-lin.cambridge.arm.com> <20160606141334.GA6579@lst.de> <20160606161245.GC29910@e104818-lin.cambridge.arm.com> <CAJVOszD16vfES8e6NcanBJ7P4HHmp635Ln7VVVyraaPnm0jriA@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1415945 |
Show key headers only | View raw
On Mon, Jun 06, 2016 at 12:09:49PM -0500, Shaun Tancheff wrote:
> I'm pretty sure it is missing a bio_put() after submit_bio_wait().
>
> Please excuse the hack-y patch but I think you need to do something
> like this ...
> (Note tabs eaten by gmail).
>
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index 23d7f30..9e29dc3 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -113,6 +113,7 @@ int blkdev_issue_discard(struct block_device
> *bdev, sector_t sector,
> ret = submit_bio_wait(type, bio);
> if (ret == -EOPNOTSUPP)
> ret = 0;
> + bio_put(bio);
> }
> blk_finish_plug(&plug);
>
> @@ -165,8 +166,10 @@ int blkdev_issue_write_same(struct block_device
> *bdev, sector_t sector,
> }
> }
>
> - if (bio)
> + if (bio) {
> ret = submit_bio_wait(REQ_WRITE | REQ_WRITE_SAME, bio);
> + bio_put(bio);
> + }
> return ret != -EOPNOTSUPP ? ret : 0;
> }
> EXPORT_SYMBOL(blkdev_issue_write_same);
> @@ -206,8 +209,11 @@ static int __blkdev_issue_zeroout(struct
> block_device *bdev, sector_t sector,
> }
> }
>
> - if (bio)
> - return submit_bio_wait(WRITE, bio);
> + if (bio) {
> + ret = submit_bio_wait(WRITE, bio);
> + bio_put(bio);
> + return ret;
> + }
> return 0;
> }
This patch appears to fix the memory leak on my machine.
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Catalin Marinas <catalin.marinas@arm.com> - 2016-06-06 13:30 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Christoph Hellwig <hch@lst.de> - 2016-06-06 16:20 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Catalin Marinas <catalin.marinas@arm.com> - 2016-06-06 18:20 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Shaun Tancheff <shaun.tancheff@seagate.com> - 2016-06-06 19:20 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Christoph Hellwig <hch@lst.de> - 2016-06-06 19:30 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Catalin Marinas <catalin.marinas@arm.com> - 2016-06-06 19:40 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Jens Axboe <axboe@kernel.dk> - 2016-06-06 20:20 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Catalin Marinas <catalin.marinas@arm.com> - 2016-06-07 11:50 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Larry Finger <Larry.Finger@lwfinger.net> - 2016-06-07 16:20 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") David Drysdale <drysdale@google.com> - 2016-06-07 17:50 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Larry Finger <Larry.Finger@lwfinger.net> - 2016-06-07 06:10 +0200
Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Christoph Hellwig <hch@lst.de> - 2016-06-07 08:40 +0200
csiph-web