Skip to content

Commit

Permalink
NFSd: handle new wdeleg_getattr attribute in /proc/net/rpc/nfsd
Browse files Browse the repository at this point in the history
This attribute was introduced it v6.6-rc1.
  • Loading branch information
klausman committed Sep 21, 2023
1 parent f22604f commit 9c4dcd1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions nfs/nfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions nfs/parse_nfsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
15 changes: 12 additions & 3 deletions nfs/parse_nfsd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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",
Expand All @@ -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,
Expand Down Expand Up @@ -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,
},
},
{
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -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,
Expand Down Expand Up @@ -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,
},
},
}
Expand Down

0 comments on commit 9c4dcd1

Please sign in to comment.