* [PATCH] NFSv4.2: fix failure to unregister shrinker
@ 2020-10-21 14:34 J. Bruce Fields
2020-11-12 14:03 ` J. Bruce Fields
0 siblings, 1 reply; 3+ messages in thread
From: J. Bruce Fields @ 2020-10-21 14:34 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs
From: "J. Bruce Fields" <bfields@redhat.com>
We forgot to unregister the nfs4_xattr_large_entry_shrinker.
That leaves the global list of shrinkers corrupted after unload of the
nfs module, after which possibly unrelated code that calls
register_shrinker() or unregister_shrinker() gets a BUG() with
"supervisor write access in kernel mode".
And similarly for the nfs4_xattr_large_entry_lru.
Reported-by: Kris Karas <bugs-a17@moonlit-rail.com>
Tested-By: Kris Karas <bugs-a17@moonlit-rail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfs/nfs42xattr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c
index 86777996cfec..55b44a42d625 100644
--- a/fs/nfs/nfs42xattr.c
+++ b/fs/nfs/nfs42xattr.c
@@ -1048,8 +1048,10 @@ int __init nfs4_xattr_cache_init(void)
void nfs4_xattr_cache_exit(void)
{
+ unregister_shrinker(&nfs4_xattr_large_entry_shrinker);
unregister_shrinker(&nfs4_xattr_entry_shrinker);
unregister_shrinker(&nfs4_xattr_cache_shrinker);
+ list_lru_destroy(&nfs4_xattr_large_entry_lru);
list_lru_destroy(&nfs4_xattr_entry_lru);
list_lru_destroy(&nfs4_xattr_cache_lru);
kmem_cache_destroy(nfs4_xattr_cache_cachep);
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] NFSv4.2: fix failure to unregister shrinker
2020-10-21 14:34 [PATCH] NFSv4.2: fix failure to unregister shrinker J. Bruce Fields
@ 2020-11-12 14:03 ` J. Bruce Fields
2020-11-12 14:07 ` Anna Schumaker
0 siblings, 1 reply; 3+ messages in thread
From: J. Bruce Fields @ 2020-11-12 14:03 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs
Looks like this patch got lost, do you need me to resend?
I should also have added a stable cc and a
Fixes: 95ad37f90c33 "NFSv4.2: add client side xattr caching."
--b.
On Wed, Oct 21, 2020 at 10:34:15AM -0400, bfields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
>
> We forgot to unregister the nfs4_xattr_large_entry_shrinker.
>
> That leaves the global list of shrinkers corrupted after unload of the
> nfs module, after which possibly unrelated code that calls
> register_shrinker() or unregister_shrinker() gets a BUG() with
> "supervisor write access in kernel mode".
>
> And similarly for the nfs4_xattr_large_entry_lru.
>
> Reported-by: Kris Karas <bugs-a17@moonlit-rail.com>
> Tested-By: Kris Karas <bugs-a17@moonlit-rail.com>
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
> fs/nfs/nfs42xattr.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c
> index 86777996cfec..55b44a42d625 100644
> --- a/fs/nfs/nfs42xattr.c
> +++ b/fs/nfs/nfs42xattr.c
> @@ -1048,8 +1048,10 @@ int __init nfs4_xattr_cache_init(void)
>
> void nfs4_xattr_cache_exit(void)
> {
> + unregister_shrinker(&nfs4_xattr_large_entry_shrinker);
> unregister_shrinker(&nfs4_xattr_entry_shrinker);
> unregister_shrinker(&nfs4_xattr_cache_shrinker);
> + list_lru_destroy(&nfs4_xattr_large_entry_lru);
> list_lru_destroy(&nfs4_xattr_entry_lru);
> list_lru_destroy(&nfs4_xattr_cache_lru);
> kmem_cache_destroy(nfs4_xattr_cache_cachep);
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] NFSv4.2: fix failure to unregister shrinker
2020-11-12 14:03 ` J. Bruce Fields
@ 2020-11-12 14:07 ` Anna Schumaker
0 siblings, 0 replies; 3+ messages in thread
From: Anna Schumaker @ 2020-11-12 14:07 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: Trond Myklebust, Linux NFS Mailing List
No need to resend! I'll make sure the fixes & cc line get added to the commit
On Thu, Nov 12, 2020 at 9:03 AM J. Bruce Fields <bfields@fieldses.org> wrote:
>
> Looks like this patch got lost, do you need me to resend?
>
> I should also have added a stable cc and a
>
> Fixes: 95ad37f90c33 "NFSv4.2: add client side xattr caching."
>
> --b.
>
> On Wed, Oct 21, 2020 at 10:34:15AM -0400, bfields wrote:
> > From: "J. Bruce Fields" <bfields@redhat.com>
> >
> > We forgot to unregister the nfs4_xattr_large_entry_shrinker.
> >
> > That leaves the global list of shrinkers corrupted after unload of the
> > nfs module, after which possibly unrelated code that calls
> > register_shrinker() or unregister_shrinker() gets a BUG() with
> > "supervisor write access in kernel mode".
> >
> > And similarly for the nfs4_xattr_large_entry_lru.
> >
> > Reported-by: Kris Karas <bugs-a17@moonlit-rail.com>
> > Tested-By: Kris Karas <bugs-a17@moonlit-rail.com>
> > Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> > ---
> > fs/nfs/nfs42xattr.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c
> > index 86777996cfec..55b44a42d625 100644
> > --- a/fs/nfs/nfs42xattr.c
> > +++ b/fs/nfs/nfs42xattr.c
> > @@ -1048,8 +1048,10 @@ int __init nfs4_xattr_cache_init(void)
> >
> > void nfs4_xattr_cache_exit(void)
> > {
> > + unregister_shrinker(&nfs4_xattr_large_entry_shrinker);
> > unregister_shrinker(&nfs4_xattr_entry_shrinker);
> > unregister_shrinker(&nfs4_xattr_cache_shrinker);
> > + list_lru_destroy(&nfs4_xattr_large_entry_lru);
> > list_lru_destroy(&nfs4_xattr_entry_lru);
> > list_lru_destroy(&nfs4_xattr_cache_lru);
> > kmem_cache_destroy(nfs4_xattr_cache_cachep);
> > --
> > 2.26.2
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-12 14:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-21 14:34 [PATCH] NFSv4.2: fix failure to unregister shrinker J. Bruce Fields
2020-11-12 14:03 ` J. Bruce Fields
2020-11-12 14:07 ` Anna Schumaker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox