From: David Howells <dhowells@redhat.com>
To: Marc Dionne <marc.dionne@auristor.com>
Cc: David Howells <dhowells@redhat.com>,
linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] afs: Fix afs_server_list to be cleaned up with RCU
Date: Thu, 16 Nov 2023 15:53:08 +0000 [thread overview]
Message-ID: <20231116155312.156593-2-dhowells@redhat.com> (raw)
In-Reply-To: <20231116155312.156593-1-dhowells@redhat.com>
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@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.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);
}
}
next prev parent reply other threads:[~2023-11-16 15:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 15:53 [PATCH 0/5] afs: Miscellaneous small fixes David Howells
2023-11-16 15:53 ` David Howells [this message]
2023-11-17 15:57 ` [PATCH 1/5] afs: Fix afs_server_list to be cleaned up with RCU Marc Dionne
2023-11-16 15:53 ` [PATCH 2/5] afs: Make error on cell lookup failure consistent with OpenAFS David Howells
2023-11-17 16:30 ` Marc Dionne
2023-11-16 15:53 ` [PATCH 3/5] afs: Return ENOENT if no cell DNS record can be found David Howells
2023-11-22 19:04 ` Marc Dionne
2023-11-16 15:53 ` [PATCH 4/5] afs: Fix file locking on R/O volumes to operate in local mode David Howells
2023-11-22 19:05 ` Marc Dionne
2023-11-16 15:53 ` [PATCH 5/5] afs: Mark a superblock for an R/O or Backup volume as SB_RDONLY David Howells
2023-11-17 15:56 ` Marc Dionne
2023-11-22 18:58 ` [PATCH 0/5] afs: Miscellaneous small fixes Jeffrey E Altman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231116155312.156593-2-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).