Skip to content

Commit 340d4b8

Browse files
authored
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 <[email protected]>
1 parent e8dd544 commit 340d4b8

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Diff for: nfs/nfs.go

+1
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ type ServerRPCStats struct {
275275
V3Stats V3Stats
276276
ServerV4Stats ServerV4Stats
277277
V4Ops V4Ops
278+
WdelegGetattr uint64
278279
}
279280

280281
// FS represents the pseudo-filesystem proc, which provides an interface to

Diff for: nfs/parse_nfsd.go

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ func ParseServerRPCStats(r io.Reader) (*ServerRPCStats, error) {
7373
stats.ServerV4Stats, err = parseServerV4Stats(values)
7474
case "proc4ops":
7575
stats.V4Ops, err = parseV4Ops(values)
76+
case "wdeleg_getattr":
77+
stats.WdelegGetattr = values[0]
7678
default:
7779
return nil, fmt.Errorf("unknown NFSd metric line %q", metricLine)
7880
}

Diff for: nfs/parse_nfsd_test.go

+12-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2
4545
proc3 22 2 112 0 2719 111 0 0 0 0 0 0 0 0 0 0 0 27 216 0 2 1 0
4646
proc4 2 2 10853
4747
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
48+
wdeleg_getattr 16
4849
`,
4950
stats: &nfs.ServerRPCStats{
5051
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
175176
Write: 0,
176177
RelLockOwner: 0,
177178
},
179+
WdelegGetattr: 16,
178180
},
179181
}, {
180182
name: "good file, proc4ops 40",
@@ -188,7 +190,9 @@ rpc 44177753 0 0 0 0
188190
proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
189191
proc3 22 747 7259760 1383711 1570520 3464939 8436 4688207 21668847 1173194 6457 2127 172 213538 1253 556401 14950 1101 56245 90790 742 367 1989658
190192
proc4 2 0 0
191-
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`,
193+
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
194+
wdeleg_getattr 9`,
195+
192196
stats: &nfs.ServerRPCStats{
193197
ReplyCache: nfs.ReplyCache{
194198
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
318322
Write: 0,
319323
RelLockOwner: 0,
320324
},
325+
WdelegGetattr: 9,
321326
},
322327
},
323328
{
@@ -332,7 +337,8 @@ rpc 742406 310 310 0 0
332337
proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
333338
proc3 22 105 71158 0 175642 184711 17103 101277 0 0 0 0 0 0 0 0 0 0 8916 102 202 0 0
334339
proc4 2 101 182991
335-
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`,
340+
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
341+
wdeleg_getattr 10`,
336342
stats: &nfs.ServerRPCStats{
337343
ReplyCache: nfs.ReplyCache{
338344
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
462468
Write: 0,
463469
RelLockOwner: 0,
464470
},
471+
WdelegGetattr: 10,
465472
},
466473
}, {
467474
name: "good file, proc4ops 39",
@@ -475,7 +482,8 @@ rpc 44177753 0 0 0 0
475482
proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
476483
proc3 22 747 7259760 1383711 1570520 3464939 8436 4688207 21668847 1173194 6457 2127 172 213538 1253 556401 14950 1101 56245 90790 742 367 1989658
477484
proc4 2 0 0
478-
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`,
485+
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
486+
wdeleg_getattr 765432`,
479487
stats: &nfs.ServerRPCStats{
480488
ReplyCache: nfs.ReplyCache{
481489
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
605613
Write: 39,
606614
RelLockOwner: 0,
607615
},
616+
WdelegGetattr: 765432,
608617
},
609618
},
610619
}

0 commit comments

Comments
 (0)