From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergey Senozhatsky Subject: Re: [PATCH 2/2] i915: do not leak module ref counter Date: Fri, 2 Aug 2019 22:35:03 +0900 Message-ID: <20190802133503.GA18318@tigerII.localdomain> References: <20190802123956.2450-1-sergey.senozhatsky@gmail.com> <20190802123956.2450-2-sergey.senozhatsky@gmail.com> <156475071634.6598.8668583907388398632@skylake-alporthouse-com> <156475141863.6598.6809215010139776043@skylake-alporthouse-com> <20190802131523.GB466@tigerII.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Content-Disposition: inline In-Reply-To: <20190802131523.GB466@tigerII.localdomain> Sender: linux-kernel-owner@vger.kernel.org To: Chris Wilson Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky List-Id: intel-gfx@lists.freedesktop.org On (08/02/19 22:15), Sergey Senozhatsky wrote: [..] > > > Looking around, it looks like we always need to drop type after > > > mounting. Should the > > > put_filesystem(type); > > > be here instead? > > > > > > Anyway, nice catch. > > > > Sigh. put_filesystem() is part of fs internals. I'd be tempted to add > > Good catch! > > So we can switch to vfs_kern_mount(), I guess, but pass different options, > depending on has_transparent_hugepage(). Hmm. This doesn't look exactly right. It appears that vfs_kern_mount() has a slightly different purpose. It's for drivers which register their own fstype and fs_context/sb callbacks. A typical usage would be static struct file_system_type nfsd_fs_type = { .owner→ → = THIS_MODULE, .name→ → = "nfsd", .init_fs_context = nfsd_init_fs_context, .kill_sb→ = nfsd_umount, }; MODULE_ALIAS_FS("nfsd"); vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL); i915 is a different beast, it just wants to mount fs and reconfigure it, it doesn't want to be an fs. So it seems that current kern_mount() is actually right. Maybe we need to export put_filesystem() instead. -ss