summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/prometheus/procfs/nfs/parse.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-02-19 11:19:39 +0000
committerGeorge Goldberg <george@gberg.me>2018-02-19 11:19:39 +0000
commitf8289eb286d00c29859a8df495b957c7b46cb249 (patch)
tree1bc18d6a3a795482c7229786f7ab427fabbcd007 /vendor/github.com/prometheus/procfs/nfs/parse.go
parent8891fa2a5e9e08eb9fa99ec163c47a6e9761a816 (diff)
parent30197584d5a215a3b25bffa79a034ed9e360cf52 (diff)
downloadchat-f8289eb286d00c29859a8df495b957c7b46cb249.tar.gz
chat-f8289eb286d00c29859a8df495b957c7b46cb249.tar.bz2
chat-f8289eb286d00c29859a8df495b957c7b46cb249.zip
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'vendor/github.com/prometheus/procfs/nfs/parse.go')
-rw-r--r--vendor/github.com/prometheus/procfs/nfs/parse.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/vendor/github.com/prometheus/procfs/nfs/parse.go b/vendor/github.com/prometheus/procfs/nfs/parse.go
index 3aa32563a..8f568f011 100644
--- a/vendor/github.com/prometheus/procfs/nfs/parse.go
+++ b/vendor/github.com/prometheus/procfs/nfs/parse.go
@@ -178,8 +178,17 @@ func parseV3Stats(v []uint64) (V3Stats, error) {
func parseClientV4Stats(v []uint64) (ClientV4Stats, error) {
values := int(v[0])
- if len(v[1:]) != values || values < 59 {
- return ClientV4Stats{}, fmt.Errorf("invalid V4Stats line %q", v)
+ if len(v[1:]) != values {
+ return ClientV4Stats{}, fmt.Errorf("invalid ClientV4Stats line %q", v)
+ }
+
+ // This function currently supports mapping 59 NFS v4 client stats. Older
+ // kernels may emit fewer stats, so we must detect this and pad out the
+ // values to match the expected slice size.
+ if values < 59 {
+ newValues := make([]uint64, 60)
+ copy(newValues, v)
+ v = newValues
}
return ClientV4Stats{