From 9a9b2157aafd2c5fec9f40b9f3c31edea9c01f95 Mon Sep 17 00:00:00 2001 From: Tobias Klausmann Date: Fri, 22 Sep 2023 15:09:32 +0200 Subject: [PATCH] NFSd: handle new wdeleg_getattr attribute in /proc/net/rpc/nfsd (#574) This attribute was introduced it v6.6-rc1. Signed-off-by: Tobias Klausmann --- nfs/nfs.go | 1 + nfs/parse_nfsd.go | 2 ++ nfs/parse_nfsd_test.go | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/nfs/nfs.go b/nfs/nfs.go index ebc059836..f17fa5105 100644 --- a/nfs/nfs.go +++ b/nfs/nfs.go @@ -275,6 +275,7 @@ type ServerRPCStats struct { V3Stats V3Stats ServerV4Stats ServerV4Stats V4Ops V4Ops + WdelegGetattr uint64 } // FS represents the pseudo-filesystem proc, which provides an interface to diff --git a/nfs/parse_nfsd.go b/nfs/parse_nfsd.go index 857ae3b96..66828e5ee 100644 --- a/nfs/parse_nfsd.go +++ b/nfs/parse_nfsd.go @@ -73,6 +73,8 @@ func ParseServerRPCStats(r io.Reader) (*ServerRPCStats, error) { stats.ServerV4Stats, err = parseServerV4Stats(values) case "proc4ops": stats.V4Ops, err = parseV4Ops(values) + case "wdeleg_getattr": + stats.WdelegGetattr = values[0] default: return nil, fmt.Errorf("unknown NFSd metric line %q", metricLine) } diff --git a/nfs/parse_nfsd_test.go b/nfs/parse_nfsd_test.go index 0d9d94ca6..a7e96895a 100644 --- a/nfs/parse_nfsd_test.go +++ b/nfs/parse_nfsd_test.go @@ -45,6 +45,7 @@ proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2 proc3 22 2 112 0 2719 111 0 0 0 0 0 0 0 0 0 0 0 27 216 0 2 1 0 proc4 2 2 10853 proc4ops 72 0 0 0 1098 2 0 0 0 0 8179 5896 0 0 0 0 5900 0 0 2 0 2 0 9609 0 2 150 1272 0 0 0 1236 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +wdeleg_getattr 16 `, stats: &nfs.ServerRPCStats{ ReplyCache: nfs.ReplyCache{ @@ -175,6 +176,7 @@ proc4ops 72 0 0 0 1098 2 0 0 0 0 8179 5896 0 0 0 0 5900 0 0 2 0 2 0 9609 0 2 150 Write: 0, RelLockOwner: 0, }, + WdelegGetattr: 16, }, }, { name: "good file, proc4ops 40", @@ -188,7 +190,9 @@ rpc 44177753 0 0 0 0 proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc3 22 747 7259760 1383711 1570520 3464939 8436 4688207 21668847 1173194 6457 2127 172 213538 1253 556401 14950 1101 56245 90790 742 367 1989658 proc4 2 0 0 -proc4ops 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0`, +proc4ops 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +wdeleg_getattr 9`, + stats: &nfs.ServerRPCStats{ ReplyCache: nfs.ReplyCache{ Hits: 0, @@ -318,6 +322,7 @@ proc4ops 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Write: 0, RelLockOwner: 0, }, + WdelegGetattr: 9, }, }, { @@ -332,7 +337,8 @@ rpc 742406 310 310 0 0 proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc3 22 105 71158 0 175642 184711 17103 101277 0 0 0 0 0 0 0 0 0 0 8916 102 202 0 0 proc4 2 101 182991 -proc4ops 59 0 0 0 18112 8341 0 0 0 3239 71595 11834 0 0 0 0 107097 0 0 8344 0 5100 0 181968 0 235 5735 4406 0 0 0 652 8342 8344 0 0 134 134 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0`, +proc4ops 59 0 0 0 18112 8341 0 0 0 3239 71595 11834 0 0 0 0 107097 0 0 8344 0 5100 0 181968 0 235 5735 4406 0 0 0 652 8342 8344 0 0 134 134 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +wdeleg_getattr 10`, stats: &nfs.ServerRPCStats{ ReplyCache: nfs.ReplyCache{ Hits: 0, @@ -462,6 +468,7 @@ proc4ops 59 0 0 0 18112 8341 0 0 0 3239 71595 11834 0 0 0 0 107097 0 0 8344 0 51 Write: 0, RelLockOwner: 0, }, + WdelegGetattr: 10, }, }, { name: "good file, proc4ops 39", @@ -475,7 +482,8 @@ rpc 44177753 0 0 0 0 proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc3 22 747 7259760 1383711 1570520 3464939 8436 4688207 21668847 1173194 6457 2127 172 213538 1253 556401 14950 1101 56245 90790 742 367 1989658 proc4 2 0 0 -proc4ops 39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 39`, +proc4ops 39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 39 +wdeleg_getattr 765432`, stats: &nfs.ServerRPCStats{ ReplyCache: nfs.ReplyCache{ Hits: 0, @@ -605,6 +613,7 @@ proc4ops 39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Write: 39, RelLockOwner: 0, }, + WdelegGetattr: 765432, }, }, }