From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Christian Brauner <brauner@kernel.org>,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
Simon Horman <horms@kernel.org>
Subject: [PATCH net-next 10/15] afs: Make afs_lookup_cell() take a trace note
Date: Mon, 24 Feb 2025 23:41:47 +0000 [thread overview]
Message-ID: <20250224234154.2014840-11-dhowells@redhat.com> (raw)
In-Reply-To: <20250224234154.2014840-1-dhowells@redhat.com>
Pass a note to be added to the afs_cell tracepoint to afs_lookup_cell() so
that different callers can be distinguished.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
fs/afs/cell.c | 13 ++++++++-----
fs/afs/dynroot.c | 3 ++-
fs/afs/internal.h | 6 ++++--
fs/afs/mntpt.c | 3 ++-
fs/afs/proc.c | 3 ++-
fs/afs/super.c | 3 ++-
fs/afs/vl_alias.c | 3 ++-
include/trace/events/afs.h | 7 ++++++-
8 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 9f5d8bc2bc5f..acdcd955f644 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -231,6 +231,7 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
* @namesz: The strlen of the cell name.
* @vllist: A colon/comma separated list of numeric IP addresses or NULL.
* @excl: T if an error should be given if the cell name already exists.
+ * @trace: The reason to be logged if the lookup is successful.
*
* Look up a cell record by name and query the DNS for VL server addresses if
* needed. Note that that actual DNS query is punted off to the manager thread
@@ -239,7 +240,8 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
*/
struct afs_cell *afs_lookup_cell(struct afs_net *net,
const char *name, unsigned int namesz,
- const char *vllist, bool excl)
+ const char *vllist, bool excl,
+ enum afs_cell_trace trace)
{
struct afs_cell *cell, *candidate, *cursor;
struct rb_node *parent, **pp;
@@ -249,7 +251,7 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,
_enter("%s,%s", name, vllist);
if (!excl) {
- cell = afs_find_cell(net, name, namesz, afs_cell_trace_use_lookup);
+ cell = afs_find_cell(net, name, namesz, trace);
if (!IS_ERR(cell))
goto wait_for_cell;
}
@@ -325,7 +327,7 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,
if (excl) {
ret = -EEXIST;
} else {
- afs_use_cell(cursor, afs_cell_trace_use_lookup);
+ afs_use_cell(cursor, trace);
ret = 0;
}
up_write(&net->cells_lock);
@@ -380,8 +382,9 @@ int afs_cell_init(struct afs_net *net, const char *rootcell)
if (cp && cp < rootcell + len)
return -EINVAL;
- /* allocate a cell record for the root cell */
- new_root = afs_lookup_cell(net, rootcell, len, vllist, false);
+ /* allocate a cell record for the root/workstation cell */
+ new_root = afs_lookup_cell(net, rootcell, len, vllist, false,
+ afs_cell_trace_use_lookup_ws);
if (IS_ERR(new_root)) {
_leave(" = %ld", PTR_ERR(new_root));
return PTR_ERR(new_root);
diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 0cf5a196d4d7..d5bb5668e788 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -108,7 +108,8 @@ static struct dentry *afs_dynroot_lookup_cell(struct inode *dir, struct dentry *
dotted = true;
}
- cell = afs_lookup_cell(net, name, len, NULL, false);
+ cell = afs_lookup_cell(net, name, len, NULL, false,
+ afs_cell_trace_use_lookup_dynroot);
if (IS_ERR(cell)) {
ret = PTR_ERR(cell);
goto out_no_cell;
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index bbd550d496a7..fcef2f7cb8ad 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -1046,8 +1046,10 @@ static inline bool afs_cb_is_broken(unsigned int cb_break,
extern int afs_cell_init(struct afs_net *, const char *);
extern struct afs_cell *afs_find_cell(struct afs_net *, const char *, unsigned,
enum afs_cell_trace);
-extern struct afs_cell *afs_lookup_cell(struct afs_net *, const char *, unsigned,
- const char *, bool);
+struct afs_cell *afs_lookup_cell(struct afs_net *net,
+ const char *name, unsigned int namesz,
+ const char *vllist, bool excl,
+ enum afs_cell_trace trace);
extern struct afs_cell *afs_use_cell(struct afs_cell *, enum afs_cell_trace);
extern void afs_unuse_cell(struct afs_net *, struct afs_cell *, enum afs_cell_trace);
extern struct afs_cell *afs_get_cell(struct afs_cell *, enum afs_cell_trace);
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 507c25a5b2cb..4a3edb9990b0 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -107,7 +107,8 @@ static int afs_mntpt_set_params(struct fs_context *fc, struct dentry *mntpt)
if (size > AFS_MAXCELLNAME)
return -ENAMETOOLONG;
- cell = afs_lookup_cell(ctx->net, p, size, NULL, false);
+ cell = afs_lookup_cell(ctx->net, p, size, NULL, false,
+ afs_cell_trace_use_lookup_mntpt);
if (IS_ERR(cell)) {
pr_err("kAFS: unable to lookup cell '%pd'\n", mntpt);
return PTR_ERR(cell);
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index e7614f4f30c2..8e71720a86bb 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -122,7 +122,8 @@ static int afs_proc_cells_write(struct file *file, char *buf, size_t size)
if (strcmp(buf, "add") == 0) {
struct afs_cell *cell;
- cell = afs_lookup_cell(net, name, strlen(name), args, true);
+ cell = afs_lookup_cell(net, name, strlen(name), args, true,
+ afs_cell_trace_use_lookup_add);
if (IS_ERR(cell)) {
ret = PTR_ERR(cell);
goto done;
diff --git a/fs/afs/super.c b/fs/afs/super.c
index dfc109f48ad5..aa6a3ccf39b5 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -290,7 +290,8 @@ static int afs_parse_source(struct fs_context *fc, struct fs_parameter *param)
/* lookup the cell record */
if (cellname) {
cell = afs_lookup_cell(ctx->net, cellname, cellnamesz,
- NULL, false);
+ NULL, false,
+ afs_cell_trace_use_lookup_mount);
if (IS_ERR(cell)) {
pr_err("kAFS: unable to lookup cell '%*.*s'\n",
cellnamesz, cellnamesz, cellname ?: "");
diff --git a/fs/afs/vl_alias.c b/fs/afs/vl_alias.c
index f9e76b604f31..ffcfba1725e6 100644
--- a/fs/afs/vl_alias.c
+++ b/fs/afs/vl_alias.c
@@ -269,7 +269,8 @@ static int yfs_check_canonical_cell_name(struct afs_cell *cell, struct key *key)
if (!name_len || name_len > AFS_MAXCELLNAME)
master = ERR_PTR(-EOPNOTSUPP);
else
- master = afs_lookup_cell(cell->net, cell_name, name_len, NULL, false);
+ master = afs_lookup_cell(cell->net, cell_name, name_len, NULL, false,
+ afs_cell_trace_use_lookup_canonical);
kfree(cell_name);
if (IS_ERR(master))
return PTR_ERR(master);
diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h
index 24d99fbc298f..42c3a51db72b 100644
--- a/include/trace/events/afs.h
+++ b/include/trace/events/afs.h
@@ -208,7 +208,12 @@ enum yfs_cm_operation {
EM(afs_cell_trace_use_check_alias, "USE chk-al") \
EM(afs_cell_trace_use_fc, "USE fc ") \
EM(afs_cell_trace_use_fc_alias, "USE fc-al ") \
- EM(afs_cell_trace_use_lookup, "USE lookup") \
+ EM(afs_cell_trace_use_lookup_add, "USE lu-add") \
+ EM(afs_cell_trace_use_lookup_canonical, "USE lu-can") \
+ EM(afs_cell_trace_use_lookup_dynroot, "USE lu-dyn") \
+ EM(afs_cell_trace_use_lookup_mntpt, "USE lu-mpt") \
+ EM(afs_cell_trace_use_lookup_mount, "USE lu-mnt") \
+ EM(afs_cell_trace_use_lookup_ws, "USE lu-ws ") \
EM(afs_cell_trace_use_mntpt, "USE mntpt ") \
EM(afs_cell_trace_use_pin, "USE pin ") \
EM(afs_cell_trace_use_probe, "USE probe ") \
next prev parent reply other threads:[~2025-02-24 23:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 23:41 [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records David Howells
2025-02-24 23:41 ` [PATCH net-next 01/15] rxrpc: rxperf: Fix missing decoding of terminal magic cookie David Howells
2025-02-24 23:41 ` [PATCH net-next 02/15] rxrpc: peer->mtu_lock is redundant David Howells
2025-02-24 23:41 ` [PATCH net-next 03/15] rxrpc: Fix locking issues with the peer record hash David Howells
2025-02-24 23:41 ` [PATCH net-next 04/15] afs: Fix the server_list to unuse a displaced server rather than putting it David Howells
2025-02-24 23:41 ` [PATCH net-next 05/15] afs: Give an afs_server object a ref on the afs_cell object it points to David Howells
2025-02-24 23:41 ` [PATCH net-next 06/15] afs: Remove the "autocell" mount option David Howells
2025-02-24 23:41 ` [PATCH net-next 07/15] afs: Change dynroot to create contents on demand David Howells
2025-02-24 23:41 ` [PATCH net-next 08/15] afs: Improve afs_volume tracing to display a debug ID David Howells
2025-02-24 23:41 ` [PATCH net-next 09/15] afs: Improve server refcount/active count tracing David Howells
2025-02-24 23:41 ` David Howells [this message]
2025-02-24 23:41 ` [PATCH net-next 11/15] afs: Drop the net parameter from afs_unuse_cell() David Howells
2025-02-24 23:41 ` [PATCH net-next 12/15] rxrpc: Allow the app to store private data on peer structs David Howells
2025-02-24 23:41 ` [PATCH net-next 13/15] afs: Use the per-peer app data provided by rxrpc David Howells
2025-02-24 23:41 ` [PATCH net-next 14/15] afs: Fix afs_server ref accounting David Howells
2025-02-24 23:41 ` [PATCH net-next 15/15] afs: Simplify cell record handling David Howells
2025-02-27 11:27 ` [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records Paolo Abeni
2025-02-27 13:10 ` David Howells
2025-02-27 14:43 ` Paolo Abeni
2025-02-27 15:36 ` Which tree to push afs + crypto + rxrpc spanning patches through? David Howells
2025-02-28 8:08 ` Herbert Xu
2025-02-27 19:20 ` [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records patchwork-bot+netdevbpf
2025-02-28 0:49 ` Jakub Kicinski
2025-02-28 6:52 ` David Howells
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=20250224234154.2014840-11-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=brauner@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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