From: Catalin Marinas <catalin.marinas@arm.com>
To: Shaun Tancheff <shaun.tancheff@seagate.com>
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
Subject: Re: kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch")
Date: Tue, 7 Jun 2016 10:39:38 +0100 [thread overview]
Message-ID: <20160607093937.GA7122@localhost> (raw)
In-Reply-To: <CAJVOszD16vfES8e6NcanBJ7P4HHmp635Ln7VVVyraaPnm0jriA@mail.gmail.com>
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>
next prev parent reply other threads:[~2016-06-07 9:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-06 11:26 kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch") Catalin Marinas
2016-06-06 14:13 ` Christoph Hellwig
2016-06-06 16:12 ` Catalin Marinas
2016-06-06 17:09 ` Shaun Tancheff
2016-06-06 17:27 ` Christoph Hellwig
2016-06-06 17:35 ` Catalin Marinas
2016-06-06 18:15 ` Jens Axboe
2016-06-07 9:39 ` Catalin Marinas [this message]
2016-06-07 14:18 ` Larry Finger
2016-06-07 15:43 ` David Drysdale
2016-06-07 4:06 ` Larry Finger
2016-06-07 6:36 ` Christoph Hellwig
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=20160607093937.GA7122@localhost \
--to=catalin.marinas@arm.com \
--cc=Larry.Finger@lwfinger.net \
--cc=axboe@fb.com \
--cc=bart.vanassche@sandisk.com \
--cc=drysdale@google.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaun.tancheff@seagate.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox