[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB9dFdvRa7Z9_zSap721gsTXJziQkuwpu=N3mP+432vxFGj2AA@mail.gmail.com>
Date: Fri, 17 Nov 2023 11:57:33 -0400
From: Marc Dionne <marc.dionne@...istor.com>
To: David Howells <dhowells@...hat.com>
Cc: linux-afs@...ts.infradead.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/5] afs: Fix afs_server_list to be cleaned up with RCU
On Thu, Nov 16, 2023 at 11:53 AM David Howells <dhowells@...hat.com> wrote:
>
> afs_server_list is accessed with the rcu_read_lock() held from
> volume->servers, so it needs to be cleaned up correctly.
>
> Fix this by using kfree_rcu() instead of kfree().
>
> Fixes: 8a070a964877 ("afs: Detect cell aliases 1 - Cells with root volumes")
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: Marc Dionne <marc.dionne@...istor.com>
> cc: linux-afs@...ts.infradead.org
> ---
> fs/afs/internal.h | 1 +
> fs/afs/server_list.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/afs/internal.h b/fs/afs/internal.h
> index c9cef3782b4a..a812952be1c9 100644
> --- a/fs/afs/internal.h
> +++ b/fs/afs/internal.h
> @@ -553,6 +553,7 @@ struct afs_server_entry {
> };
>
> struct afs_server_list {
> + struct rcu_head rcu;
> afs_volid_t vids[AFS_MAXTYPES]; /* Volume IDs */
> refcount_t usage;
> unsigned char nr_servers;
> diff --git a/fs/afs/server_list.c b/fs/afs/server_list.c
> index ed9056703505..b59896b1de0a 100644
> --- a/fs/afs/server_list.c
> +++ b/fs/afs/server_list.c
> @@ -17,7 +17,7 @@ void afs_put_serverlist(struct afs_net *net, struct afs_server_list *slist)
> for (i = 0; i < slist->nr_servers; i++)
> afs_unuse_server(net, slist->servers[i].server,
> afs_server_trace_put_slist);
> - kfree(slist);
> + kfree_rcu(slist, rcu);
> }
> }
Reviewed-by: Marc Dionne <marc.dionne@...istor.com>
Marc
Powered by blists - more mailing lists