* [PATCH] Free the temporary vfsmount created in bdev_cache_init()
@ 2009-01-14 11:40 Catalin Marinas
0 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2009-01-14 11:40 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Cheng Renquan
The vfsmount structure allocated in this function (the bd_mnt local
variable) is only used to obtain the blockdev_superblock and there are
no other references to it. This structure can be safely freed.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Cheng Renquan <crquan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
fs/block_dev.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index b3c1eff..5124756 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -346,6 +346,7 @@ void __init bdev_cache_init(void)
if (IS_ERR(bd_mnt))
panic("Cannot create bdev pseudo-fs");
blockdev_superblock = bd_mnt->mnt_sb; /* For writeback */
+ free_vfsmnt(bd_mnt);
}
/*
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] Free the temporary vfsmount created in bdev_cache_init()
@ 2009-04-01 11:07 Catalin Marinas
2009-04-01 11:49 ` Al Viro
0 siblings, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2009-04-01 11:07 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Cheng Renquan
The vfsmount structure allocated in this function (the bd_mnt local
variable) is only used to obtain the blockdev_superblock and there are
no other references to it. This structure can be safely freed (and
prevent kmemleak from reporting it).
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Cheng Renquan <crquan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
This patch was submitted and acked some time ago but I don't think it
made it into the kernel. Here it is again. Thanks.
fs/block_dev.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 8c3c689..e7a332f 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -492,6 +492,7 @@ void __init bdev_cache_init(void)
if (IS_ERR(bd_mnt))
panic("Cannot create bdev pseudo-fs");
blockdev_superblock = bd_mnt->mnt_sb; /* For writeback */
+ free_vfsmnt(bd_mnt);
}
/*
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Free the temporary vfsmount created in bdev_cache_init()
2009-04-01 11:07 [PATCH] Free the temporary vfsmount created in bdev_cache_init() Catalin Marinas
@ 2009-04-01 11:49 ` Al Viro
2009-04-01 12:12 ` Catalin Marinas
0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2009-04-01 11:49 UTC (permalink / raw)
To: Catalin Marinas; +Cc: linux-kernel, Andrew Morton, Cheng Renquan
On Wed, Apr 01, 2009 at 12:07:37PM +0100, Catalin Marinas wrote:
> The vfsmount structure allocated in this function (the bd_mnt local
> variable) is only used to obtain the blockdev_superblock and there are
> no other references to it. This structure can be safely freed (and
> prevent kmemleak from reporting it).
NAK. This kind of kludges is simply not worth doing. Store the
pointer to vfsmount into a static-in-file variable if you want
to get kmemleak to STFU.
Savings on a vfsmount are not worth neurons needed to remember that
in this particular case we are OK to do something that is utterly
wrong in general (free_vfsmnt() is a very low-level stuff that shouldn't
be used outside of namespace.c and super.c).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Free the temporary vfsmount created in bdev_cache_init()
2009-04-01 11:49 ` Al Viro
@ 2009-04-01 12:12 ` Catalin Marinas
0 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2009-04-01 12:12 UTC (permalink / raw)
To: Al Viro; +Cc: linux-kernel, Andrew Morton, Cheng Renquan
On Wed, 2009-04-01 at 12:49 +0100, Al Viro wrote:
> On Wed, Apr 01, 2009 at 12:07:37PM +0100, Catalin Marinas wrote:
> > The vfsmount structure allocated in this function (the bd_mnt local
> > variable) is only used to obtain the blockdev_superblock and there are
> > no other references to it. This structure can be safely freed (and
> > prevent kmemleak from reporting it).
>
> NAK. This kind of kludges is simply not worth doing. Store the
> pointer to vfsmount into a static-in-file variable if you want
> to get kmemleak to STFU.
That's how it used to be until commit c2acf7b9 made bd_mnt a local
variable. Rather than reverting part of this commit, I can add a
kmemleak_ignore() call to shut it up.
--
Catalin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-04-01 12:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-01 11:07 [PATCH] Free the temporary vfsmount created in bdev_cache_init() Catalin Marinas
2009-04-01 11:49 ` Al Viro
2009-04-01 12:12 ` Catalin Marinas
-- strict thread matches above, loose matches on Subject: below --
2009-01-14 11:40 Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox