nfsdtop icon indicating copy to clipboard operation
nfsdtop copied to clipboard

nfsdtop.linux does not count NFS4 write traffic

Open rrzefox opened this issue 1 year ago • 0 comments

I think I have found a bug in nfsdtop.linux: It currently does not count any NFS4 write traffic.

Looking at the code, I see the following in kprobe:nfsd4_write:

@nfsd4_write_count[tid] = $nfsd4_write->wr_bytes_written;

That seems wrong. When the write function is entered, obviously 0 bytes have been written so far. We would need to read wr_bytes_written when the function returns instead, it will always contain 0 before the function runs.

As a workaround, I tried resorting to $nfsd4_write->wr_buflen instead. That does yield results that look far more in line with the actual network and disc traffic of the server I tried this on - but obviously it is prone to overcounting if not all bytes are written, e.g. because the user exceeded the quota. I'm unsure if there is a better fix, otherwise I'd propose a patch.

Thanks for this great tool!

rrzefox avatar Mar 17 '23 11:03 rrzefox