From nobody Sun Feb 8 14:13:00 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBFB820DD67 for ; Mon, 24 Feb 2025 23:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740440573; cv=none; b=bB/Qp8zHM6utMzWDJiGUwKes8zH3hKQrYinOM1N+qk9Papb/+WcOAifit6BiGn1vrSJWlGthj2JBSGX+A/SLU9x4egXnaMJ9AsQAsUenZSR3KEf76cfIxq6F5xWtyhqMRBG5/vNvgsdAN9mdtPSb7DSjQ54acqtk8rVGIj2X3+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740440573; c=relaxed/simple; bh=wti+nj9OPTh/bErQ5E4oKhRSKmC0KR1tHufxQXAG6jo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HlLDrVXQYU1hcVQxphbj6DcJ456z6DirA0sY+T9bznFK5/4E+ZnDGveuytJ2JKEYomgHrZbPee4If0y63VEkNjTVby6DSsdXljslJXl38LuE0NDAxRrUPMKt3R0CmW807HPSNYw1iDFvKQxQ5EGDE4ID+J8lmXGxWAvzCFoGKno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZitD/OoX; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZitD/OoX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740440570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xhNgi6WOoRTfLf6jGt4MeG/7EO7nsIITUX1Wg/NI4TM=; b=ZitD/OoXoSmCDOzWO0cESrOfrsPKoHGu3MHC5mZak7GwYtXTKyHZ7aF8WFVbNbQNsHodNJ DiFiCNVaF7X3Y0aUT8isgJ6WZR7Awt+MP2jKajML3D99d/17ZD61RTgKmdKFdvnGWbqJq0 GNaxNceo6rOAZjXqgj94LvyYnEyRvVI= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-463-BudGJgQyN6uppa6OnIc8Ow-1; Mon, 24 Feb 2025 18:42:47 -0500 X-MC-Unique: BudGJgQyN6uppa6OnIc8Ow-1 X-Mimecast-MFC-AGG-ID: BudGJgQyN6uppa6OnIc8Ow_1740440565 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CAA7A1800878; Mon, 24 Feb 2025 23:42:45 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.9]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C71B719560AE; Mon, 24 Feb 2025 23:42:42 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Christian Brauner , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH net-next 10/15] afs: Make afs_lookup_cell() take a trace note Date: Mon, 24 Feb 2025 23:41:47 +0000 Message-ID: <20250224234154.2014840-11-dhowells@redhat.com> In-Reply-To: <20250224234154.2014840-1-dhowells@redhat.com> References: <20250224234154.2014840-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" 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 cc: Marc Dionne cc: Jakub Kicinski cc: "David S. Miller" cc: Eric Dumazet cc: Paolo Abeni cc: Simon Horman 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 t= hread @@ -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); =20 if (!excl) { - cell =3D afs_find_cell(net, name, namesz, afs_cell_trace_use_lookup); + cell =3D 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 =3D -EEXIST; } else { - afs_use_cell(cursor, afs_cell_trace_use_lookup); + afs_use_cell(cursor, trace); ret =3D 0; } up_write(&net->cells_lock); @@ -380,8 +382,9 @@ int afs_cell_init(struct afs_net *net, const char *root= cell) if (cp && cp < rootcell + len) return -EINVAL; =20 - /* allocate a cell record for the root cell */ - new_root =3D afs_lookup_cell(net, rootcell, len, vllist, false); + /* allocate a cell record for the root/workstation cell */ + new_root =3D afs_lookup_cell(net, rootcell, len, vllist, false, + afs_cell_trace_use_lookup_ws); if (IS_ERR(new_root)) { _leave(" =3D %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 in= ode *dir, struct dentry * dotted =3D true; } =20 - cell =3D afs_lookup_cell(net, name, len, NULL, false); + cell =3D afs_lookup_cell(net, name, len, NULL, false, + afs_cell_trace_use_lookup_dynroot); if (IS_ERR(cell)) { ret =3D 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 *, unsi= gned, enum afs_cell_trace); -extern struct afs_cell *afs_lookup_cell(struct afs_net *, const char *, un= signed, - 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_trac= e); extern void afs_unuse_cell(struct afs_net *, struct afs_cell *, enum afs_c= ell_trace); extern struct afs_cell *afs_get_cell(struct afs_cell *, enum afs_cell_trac= e); 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; =20 - cell =3D afs_lookup_cell(ctx->net, p, size, NULL, false); + cell =3D 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") =3D=3D 0) { struct afs_cell *cell; =20 - cell =3D afs_lookup_cell(net, name, strlen(name), args, true); + cell =3D afs_lookup_cell(net, name, strlen(name), args, true, + afs_cell_trace_use_lookup_add); if (IS_ERR(cell)) { ret =3D 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, stru= ct fs_parameter *param) /* lookup the cell record */ if (cellname) { cell =3D 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_cel= l *cell, struct key *key) if (!name_len || name_len > AFS_MAXCELLNAME) master =3D ERR_PTR(-EOPNOTSUPP); else - master =3D afs_lookup_cell(cell->net, cell_name, name_len, NULL, false); + master =3D 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 ") \