add nfs v3 support to nfsdist.py
add nfs v3 support to nfsdist.py
@@ -137,16 +137,21 @@ b = BPF(text=bpf_text)
# common file functions
b.attach_kprobe(event="nfs_file_read", fn_name="trace_entry")
b.attach_kprobe(event="nfs_file_write", fn_name="trace_entry")
-b.attach_kprobe(event="nfs4_file_open", fn_name="trace_entry")
b.attach_kprobe(event="nfs_file_open", fn_name="trace_entry")
b.attach_kprobe(event="nfs_getattr", fn_name="trace_entry")
b.attach_kretprobe(event="nfs_file_read", fn_name="trace_read_return")
b.attach_kretprobe(event="nfs_file_write", fn_name="trace_write_return")
-b.attach_kretprobe(event="nfs4_file_open", fn_name="trace_open_return")
b.attach_kretprobe(event="nfs_file_open", fn_name="trace_open_return")
b.attach_kretprobe(event="nfs_getattr", fn_name="trace_getattr_return")
+if BPF.get_kprobe_functions(b'nfs4_file_open'):
+ b.attach_kprobe(event="nfs4_file_open", fn_name="trace_entry")
+ b.attach_kretprobe(event="nfs4_file_open", fn_name="trace_open_return")
+else:
+ b.attach_kprobe(event="nfs_file_open", fn_name="trace_entry")
+ b.attach_kretprobe(event="nfs_file_open", fn_name="trace_open_return")
+
print("Tracing NFS operation latency... Hit Ctrl-C to end.")
# output
