linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 1/2] fs: export put_filesystem()
@ 2019-08-20  3:13 Sergey Senozhatsky
  2019-08-20  3:13 ` [PATCHv2 2/2] i915: do not leak module ref counter Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2019-08-20  3:13 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Chris Wilson,
	Alexander Viro, David Howells, Christoph Hellwig
  Cc: intel-gfx, dri-devel, linux-kernel, linux-fsdevel, Sergey Senozhatsky

Modules, e.g. i915, can use exported get_fs_type(), but are
unable to put_filesystem(). Export it and let modules to
decrement file systems' reference counters.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 fs/filesystems.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/filesystems.c b/fs/filesystems.c
index 9135646e41ac..02669839b584 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -45,6 +45,7 @@ void put_filesystem(struct file_system_type *fs)
 {
 	module_put(fs->owner);
 }
+EXPORT_SYMBOL(put_filesystem);
 
 static struct file_system_type **find_filesystem(const char *name, unsigned len)
 {
-- 
2.23.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCHv2 2/2] i915: do not leak module ref counter
  2019-08-20  3:13 [PATCHv2 1/2] fs: export put_filesystem() Sergey Senozhatsky
@ 2019-08-20  3:13 ` Sergey Senozhatsky
  2019-08-20  5:56   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2019-08-20  3:13 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Chris Wilson,
	Alexander Viro, David Howells, Christoph Hellwig
  Cc: intel-gfx, dri-devel, linux-kernel, linux-fsdevel, Sergey Senozhatsky

Always put_filesystem() in i915_gemfs_init().

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 - v2: rebased (i915 does not remount gemfs anymore)

 drivers/gpu/drm/i915/gem/i915_gemfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gemfs.c b/drivers/gpu/drm/i915/gem/i915_gemfs.c
index 5e6e8c91ab38..0a398e1e45fc 100644
--- a/drivers/gpu/drm/i915/gem/i915_gemfs.c
+++ b/drivers/gpu/drm/i915/gem/i915_gemfs.c
@@ -30,6 +30,7 @@ int i915_gemfs_init(struct drm_i915_private *i915)
 	 */
 
 	gemfs = kern_mount(type);
+	put_filesystem(type);
 	if (IS_ERR(gemfs))
 		return PTR_ERR(gemfs);
 
-- 
2.23.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv2 2/2] i915: do not leak module ref counter
  2019-08-20  3:13 ` [PATCHv2 2/2] i915: do not leak module ref counter Sergey Senozhatsky
@ 2019-08-20  5:56   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-08-20  5:56 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Chris Wilson,
	Alexander Viro, David Howells, Christoph Hellwig, intel-gfx,
	dri-devel, linux-kernel, linux-fsdevel, Sergey Senozhatsky

On Tue, Aug 20, 2019 at 12:13:59PM +0900, Sergey Senozhatsky wrote:
> Always put_filesystem() in i915_gemfs_init().
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
>  - v2: rebased (i915 does not remount gemfs anymore)

Which means it real doesn't need its mount anyore, and thus can use
plain old shmem_file_setup and doesn't need to mess with file system
types at all.

Assuming we find a legitimate rason for why a driver should be able
to create a kernel mount or a file system type where it doesn't have
access to the struct file_system_type an API that mount by file system
name and thus hides the get_fs_type and put_filesystem would be a much
better API than adding this random export.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-20  5:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20  3:13 [PATCHv2 1/2] fs: export put_filesystem() Sergey Senozhatsky
2019-08-20  3:13 ` [PATCHv2 2/2] i915: do not leak module ref counter Sergey Senozhatsky
2019-08-20  5:56   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).