From nobody Sat Feb 7 14:45:51 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5D2E128150F; Sat, 3 May 2025 19:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746302392; cv=none; b=rK1rze82t4rI6OnCgBgB94eiJFwxPGmQS7mhKcFeqxLMXaNcEe7VAPQl1OdejgS61nyOQe2bmLXhHOn9f8QAxfEnI0D09EjKQ2+3oAwK8lKVH0eIOhBF7w8s3ybZOODEWifUwKtXKoM9lNtoXQzDBNEEQ4s+VMBquPooL+2aoYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746302392; c=relaxed/simple; bh=ZKs0bRbmtNComB3idWcyiEEWtYkgrA5qtpbBITjrpuA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TpYcpcwMn/pQIK2RsHxUlwrnX6Mq3DSP9mx5azeR2I7LwyvIHQUnsnBQPT+PUufYg7JnxRiuaREkGR998KkiPX9n1QZThIDyfrE/mDhu11W/jduW/CsfQ9I6HSbA211jPQS094o+qiwNowS28T1wL8MAcUhG9qMri6K6SBtoSDE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l5Bmxx3V; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l5Bmxx3V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E51F4C4CEF1; Sat, 3 May 2025 19:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746302391; bh=ZKs0bRbmtNComB3idWcyiEEWtYkgrA5qtpbBITjrpuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l5Bmxx3VSgNxEdpLmMUkQqE8BNzTN1GL4eCRr8wmjhohbuliOnbVEymzbDXT2U64J +IoWds50gO+J1oVaarNg7FX3+Og7iWFRwaRTstGBf3HLr9+iIHbPWhxqV8XTzTo3XU zBg5KnVYEyMl6L2tD1Va+kVSnhUQq28aIajN3pFXxjuEePx2/7VWuORUoa3KHBZSGB 01LQjUScTOlRQOip9NS5Kebv4BY/mi23EMilofmmhlbhurVOw0L73ajF/DPEhhaeeB qjWt76NyTrLPjqXFZFJHmSNg866vPFgKbfvwJw/gol2Tn3vgiqXN7mSonPLvza17/o xJahD0wGloSLg== From: cel@kernel.org To: NeilBrown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey , Trond Myklebust , Anna Schumaker Cc: sargun@sargun.me, , Subject: [PATCH v4 11/18] nfsd: add tracepoint for getattr and statfs events Date: Sat, 3 May 2025 15:59:29 -0400 Message-ID: <20250503195936.5083-12-cel@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250503195936.5083-1-cel@kernel.org> References: <20250503195936.5083-1-cel@kernel.org> 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 Content-Type: text/plain; charset="utf-8" From: Jeff Layton There isn't a common helper for getattrs, so add these into the protocol-specific helpers. Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever --- fs/nfsd/nfs3proc.c | 2 ++ fs/nfsd/nfs4proc.c | 2 ++ fs/nfsd/nfsproc.c | 2 ++ fs/nfsd/trace.h | 30 ++++++++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 5 files changed, 38 insertions(+) diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index 80096a5c4865..f6eb8331dc4b 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -70,6 +70,8 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp) struct nfsd_fhandle *argp =3D rqstp->rq_argp; struct nfsd3_attrstat *resp =3D rqstp->rq_resp; =20 + trace_nfsd_vfs_getattr(rqstp, &argp->fh); + dprintk("nfsd: GETATTR(3) %s\n", SVCFH_fmt(&argp->fh)); =20 diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 483fd8b26f9d..2b16ee1ae461 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -876,6 +876,8 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_comp= ound_state *cstate, struct nfsd4_getattr *getattr =3D &u->getattr; __be32 status; =20 + trace_nfsd_vfs_getattr(rqstp, &cstate->current_fh); + status =3D fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP); if (status) return status; diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index c561af30c37a..8816cc565c0c 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -55,6 +55,8 @@ nfsd_proc_getattr(struct svc_rqst *rqstp) struct nfsd_fhandle *argp =3D rqstp->rq_argp; struct nfsd_attrstat *resp =3D rqstp->rq_resp; =20 + trace_nfsd_vfs_getattr(rqstp, &argp->fh); + dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); =20 fh_copy(&resp->fh, &argp->fh); diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index bed58cf55c10..3c5505ef5e3a 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -2579,6 +2579,36 @@ TRACE_EVENT(nfsd_vfs_readdir, ) ); =20 +DECLARE_EVENT_CLASS(nfsd_vfs_getattr_class, + TP_PROTO( + const struct svc_rqst *rqstp, + const struct svc_fh *fhp + ), + TP_ARGS(rqstp, fhp), + TP_STRUCT__entry( + NFSD_TRACE_PROC_CALL_FIELDS(rqstp) + __field(u32, fh_hash) + ), + TP_fast_assign( + NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp); + __entry->fh_hash =3D knfsd_fh_hash(&fhp->fh_handle); + ), + TP_printk("xid=3D0x%08x fh_hash=3D0x%08x", + __entry->xid, __entry->fh_hash + ) +); + +#define DEFINE_NFSD_VFS_GETATTR_EVENT(__name) \ +DEFINE_EVENT(nfsd_vfs_getattr_class, __name, \ + TP_PROTO( \ + const struct svc_rqst *rqstp, \ + const struct svc_fh *fhp \ + ), \ + TP_ARGS(rqstp, fhp)) + +DEFINE_NFSD_VFS_GETATTR_EVENT(nfsd_vfs_getattr); +DEFINE_NFSD_VFS_GETATTR_EVENT(nfsd_vfs_statfs); + #endif /* _NFSD_TRACE_H */ =20 #undef TRACE_INCLUDE_PATH diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 41314b2a8199..d0dfd97de4d3 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -2290,6 +2290,8 @@ nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fh= p, struct kstatfs *stat, in { __be32 err; =20 + trace_nfsd_vfs_statfs(rqstp, fhp); + err =3D fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP | access); if (!err) { struct path path =3D { --=20 2.49.0