Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1416381 > unrolled thread
| Started by | Shaun Tancheff <shaun@tancheff.com> |
|---|---|
| First post | 2016-06-07 18:30 +0200 |
| Last post | 2016-06-12 12:30 +0200 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH] Fix reported kmemleak Shaun Tancheff <shaun@tancheff.com> - 2016-06-07 18:30 +0200
[PATCH] Missing bio_put following submit_bio_wait Shaun Tancheff <shaun@tancheff.com> - 2016-06-07 18:40 +0200
Re: [PATCH] Missing bio_put following submit_bio_wait Christoph Hellwig <hch@lst.de> - 2016-06-07 18:50 +0200
Re: [PATCH] Missing bio_put following submit_bio_wait Jens Axboe <axboe@kernel.dk> - 2016-06-07 18:50 +0200
Re: [PATCH] Fix reported kmemleak Xiong Zhou <xzhou@redhat.com> - 2016-06-12 12:30 +0200
| From | Shaun Tancheff <shaun@tancheff.com> |
|---|---|
| Date | 2016-06-07 18:30 +0200 |
| Subject | [PATCH] Fix reported kmemleak |
| Message-ID | <rHs38-4Y1-25@gated-at.bofh.it> |
This fixes a memory leak reported by a few people in 4.7-rc1
kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch")
This patch just formalizes the one in this discussion here:
https://lkml.kernel.org/r/20160606112620.GA29910@e104818-lin.cambridge.arm.com
The same issue appears here:
https://lkml.kernel.org/r/20160607102651.GA6480@dhcp12-144.nay.redhat.com
Patch is also available at:
https://github.com/stancheff/linux.git
branch: v4.7-rc2+bio_put
Cc: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk
cc: David Drysdale <drysdale@google.com>
Cc: Xiong Zhou <xzhou@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: linux-next@vger.kernel.org
Cc: linux-nvdimm@ml01.01.org
Cc: Christoph Hellwig <hch@lst.de>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Cc: Jens Axboe <axboe@fb.com>,
Cc: bart.vanassche@sandisk.com
Shaun Tancheff (1):
Missing bio_put following submit_bio_wait
block/blk-lib.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
--
2.8.1
[toc] | [next] | [standalone]
| From | Shaun Tancheff <shaun@tancheff.com> |
|---|---|
| Date | 2016-06-07 18:40 +0200 |
| Subject | [PATCH] Missing bio_put following submit_bio_wait |
| Message-ID | <rHscN-51h-13@gated-at.bofh.it> |
| In reply to | #1416381 |
submit_bio_wait() gives the caller an opportunity to examine
struct bio and so expects the caller to issue the put_bio()
This fixes a memory leak reported by a few people in 4.7-rc2
kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch")
Signed-off-by: Shaun Tancheff <shaun.tancheff@seagate.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Larry Finger@lwfinger.net
Tested-by: David Drysdale <drysdale@google.com>
---
block/blk-lib.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
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;
}
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Date | 2016-06-07 18:50 +0200 |
| Subject | Re: [PATCH] Missing bio_put following submit_bio_wait |
| Message-ID | <rHsmt-56I-17@gated-at.bofh.it> |
| In reply to | #1416401 |
Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de>
[toc] | [prev] | [next] | [standalone]
| From | Jens Axboe <axboe@kernel.dk> |
|---|---|
| Date | 2016-06-07 18:50 +0200 |
| Subject | Re: [PATCH] Missing bio_put following submit_bio_wait |
| Message-ID | <rHsmu-56I-33@gated-at.bofh.it> |
| In reply to | #1416401 |
On 06/07/2016 10:32 AM, Shaun Tancheff wrote:
> submit_bio_wait() gives the caller an opportunity to examine
> struct bio and so expects the caller to issue the put_bio()
>
> This fixes a memory leak reported by a few people in 4.7-rc2
> kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch")
>
> Signed-off-by: Shaun Tancheff <shaun.tancheff@seagate.com>
> Tested-by: Catalin Marinas <catalin.marinas@arm.com>
> Tested-by: Larry Finger@lwfinger.net
> Tested-by: David Drysdale <drysdale@google.com>
Thanks, applied.
--
Jens Axboe
[toc] | [prev] | [next] | [standalone]
| From | Xiong Zhou <xzhou@redhat.com> |
|---|---|
| Date | 2016-06-12 12:30 +0200 |
| Message-ID | <rJaOt-7sW-5@gated-at.bofh.it> |
| In reply to | #1416381 |
Hi,
On Tue, Jun 07, 2016 at 11:23:30AM -0500, Shaun Tancheff wrote:
> This fixes a memory leak reported by a few people in 4.7-rc1
>
> kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch")
>
> This patch just formalizes the one in this discussion here:
> https://lkml.kernel.org/r/20160606112620.GA29910@e104818-lin.cambridge.arm.com
>
> The same issue appears here:
> https://lkml.kernel.org/r/20160607102651.GA6480@dhcp12-144.nay.redhat.com
>
> Patch is also available at:
>
> https://github.com/stancheff/linux.git
> branch: v4.7-rc2+bio_put
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: axboe@kernel.dk
> cc: David Drysdale <drysdale@google.com>
> Cc: Xiong Zhou <xzhou@redhat.com>
Thanks for the information!
> Cc: Stephen Rothwell <sfr@canb.auug.org.au>
> Cc: linux-next@vger.kernel.org
> Cc: linux-nvdimm@ml01.01.org
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: LKML <linux-kernel@vger.kernel.org>,
> Cc: Jens Axboe <axboe@fb.com>,
> Cc: bart.vanassche@sandisk.com
>
> Shaun Tancheff (1):
> Missing bio_put following submit_bio_wait
>
> block/blk-lib.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> --
> 2.8.1
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web