From fb68439fc287231473357c38b6fcd146982b0cbb Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 31 May 2013 09:05:23 -0500 Subject: [PATCH] Fixed BZ920444 by using macros to handle nfs parameter changes. * tapset/linux/nfs_proc.stpm: New file. * tapset/linux/nfs_proc.stp: Remove __i2n_ip_proto(), __nfs_read_data_info(), and __nfs_write_data_info() functions. Callers of those functions now use new macros in nfs_proc.stpm. The advantage the macros have, besides clarity, is that they preserve type information. Kernel commit 0b7c01533aa9f4a228d07d2768d084acb3a387bc changed the commit functions to take a nfs_commit_data structure instead of a nfs_write_data_structure. Because functions lose type information, systemtap didn't notice this change. --- tapset/linux/nfs_proc.stp | 336 ++++++++++++++++--------------------- tapset/linux/nfs_proc.stpm | 46 +++++ 2 files changed, 186 insertions(+), 196 deletions(-) create mode 100644 tapset/linux/nfs_proc.stpm diff --git a/tapset/linux/nfs_proc.stp b/tapset/linux/nfs_proc.stp index 99dc58fab..726df4836 100644 --- a/tapset/linux/nfs_proc.stp +++ b/tapset/linux/nfs_proc.stp @@ -1,6 +1,6 @@ // NFS procedure tapset // Copyright (C) 2006 IBM Corp. -// Copyright (C) 2007-2012 Red Hat +// Copyright (C) 2007-2013 Red Hat // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -102,75 +102,6 @@ function get_prot:long(task:long) return get_prot_from_client(clnt) } -/* - 0:get ip address - 1:get proto -*/ -function __i2n_ip_proto:long(dir:long, index:long) -{ - clnt = NFS_CLIENT(dir) - - if (index == 0) - return get_ip_from_client(clnt) - if (index == 1) - return get_prot_from_client(clnt) - return 0 -} - -/* - 0: get ip address - 1: get proto - 2: get res->count - 3: get res->fattr->valid - 4: get timestamp -*/ -function __nfs_read_data_info:long (rdata :long, index :long) -{ - task = &@cast(rdata, "nfs_read_data", "kernel:nfs")->task - rres = &@cast(rdata, "nfs_read_data", "kernel:nfs")->res - - if (index == 0) - return get_ip(task) - if (index == 1) - return get_prot(task) - if (index == 2) - return @cast(rres, "nfs_readres", "kernel:nfs")->count - if (index == 3) - return @cast(rres, "nfs_readres", "kernel:nfs")->fattr->valid -%( CONFIG_NFS_V4 == "[ym]" %? - if (index == 4) - return @cast(rdata, "nfs_read_data", "kernel:nfs")->timestamp -%) - return 0 -} - -/* - 0: get ip address - 1: get proto - 2: get res->count - 3: get res->fattr->valid - 4: get timestamp -*/ -function __nfs_write_data_info:long (wdata :long, index :long) -{ - task = &@cast(wdata, "nfs_write_data", "kernel:nfs")->task - wres = &@cast(wdata, "nfs_write_data", "kernel:nfs")->res - - if (index == 0) - return get_ip(task) - if (index == 1) - return get_prot(task) - if (index == 2) - return @cast(wres, "nfs_writeres", "kernel:nfs")->count - if (index == 3) - return @cast(wres, "nfs_writeres", "kernel:nfs")->fattr->valid -%( CONFIG_NFS_V4 == "[ym]" %? - if (index == 4) - return @cast(wdata, "nfs_write_data", "kernel:nfs")->timestamp -%) - return 0 -} - function __nfsv4_bitmask:long(dir:long, i:long) { %( CONFIG_NFS_V4 == "[ym]" %? @@ -250,8 +181,9 @@ probe nfs.proc2.lookup = kernel.function("nfs_proc_lookup") !, module("nfs").function("nfs_proc_lookup") ?, module("nfsv2").function("nfs_proc_lookup") ? { - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 2 name_len = $name->len @@ -277,9 +209,9 @@ probe nfs.proc3.lookup = kernel.function("nfs3_proc_lookup") !, module("nfs").function("nfs3_proc_lookup") ?, module("nfsv3").function("nfs3_proc_lookup") ? { - - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 3 name_len = $name->len @@ -306,9 +238,9 @@ probe nfs.proc4.lookup = kernel.function("nfs4_proc_lookup") !, module("nfs").function("nfs4_proc_lookup") ?, module("nfsv4").function("nfs4_proc_lookup") ? { - - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 4 name_len = $name->len @@ -361,12 +293,12 @@ probe nfs.proc2.read = kernel.function("nfs_proc_read") !, module("nfs").function("nfs_proc_read") ?, module("nfsv2").function("nfs_proc_read") ? { - server_ip = __nfs_read_data_info($rdata, 0) - prot = __nfs_read_data_info($rdata, 1) + server_ip = @_nfs_data_server_ip($rdata) + prot = @_nfs_data_prot($rdata) version = 2 flags = $rdata->flags - count = $rdata->args->count + count = @_nfs_data_args_count($rdata) offset = $rdata->args->offset name = "nfs.proc2.read" @@ -390,12 +322,12 @@ probe nfs.proc3.read = kernel.function("nfs3_proc_read") !, module("nfs").function("nfs3_proc_read") ?, module("nfsv3").function("nfs3_proc_read") ? { - server_ip = __nfs_read_data_info($rdata, 0) - prot = __nfs_read_data_info($rdata, 1) + server_ip = @_nfs_data_server_ip($rdata) + prot = @_nfs_data_prot($rdata) version = 3 flags = $rdata->flags - count = $rdata->args->count + count = @_nfs_data_args_count($rdata) offset = $rdata->args->offset name = "nfs.proc3.read" @@ -419,12 +351,12 @@ probe nfs.proc4.read = kernel.function("nfs4_proc_read") !, module("nfs").function("nfs4_proc_read") ?, module("nfsv3").function("nfs4_proc_read") ? { - server_ip = __nfs_read_data_info($rdata, 0) - prot = __nfs_read_data_info($rdata, 1) + server_ip = @_nfs_data_server_ip($rdata) + prot = @_nfs_data_prot($rdata) version = 4 flags = $rdata->flags - count = $rdata->args->count + count = @_nfs_data_args_count($rdata) offset = $rdata->args->offset name = "nfs.proc4.read" @@ -480,12 +412,12 @@ probe nfs.proc2.write = kernel.function("nfs_proc_write") !, module("nfs").function("nfs_proc_write") ?, module("nfsv2").function("nfs_proc_write") ? { - server_ip = __nfs_write_data_info($wdata, 0) - prot = __nfs_write_data_info($wdata, 1) + server_ip = @_nfs_data_server_ip($wdata) + prot = @_nfs_data_prot($wdata) version = 2 flags = $wdata->flags - count = $wdata->args->count + count = @_nfs_data_args_count($wdata) offset = $wdata->args->offset bitmask0 = 0 bitmask1 = 0 @@ -516,12 +448,12 @@ probe nfs.proc3.write = kernel.function("nfs3_proc_write") !, module("nfs").function("nfs3_proc_write") ?, module("nfsv3").function("nfs3_proc_write") ? { - server_ip = __nfs_write_data_info($wdata, 0) - prot = __nfs_write_data_info($wdata, 1) + server_ip = @_nfs_data_server_ip($wdata) + prot = @_nfs_data_prot($wdata) version = 3 flags = $wdata->flags - count = $wdata->args->count + count = @_nfs_data_args_count($wdata) offset = $wdata->args->offset bitmask0 = 0 bitmask1 = 0 @@ -554,12 +486,12 @@ probe nfs.proc4.write = kernel.function("nfs4_proc_write") !, module("nfs").function("nfs4_proc_write") ?, module("nfsv4").function("nfs4_proc_write") ? { - server_ip = __nfs_write_data_info($wdata, 0) - prot = __nfs_write_data_info($wdata, 1) + server_ip = @_nfs_data_server_ip($wdata) + prot = @_nfs_data_prot($wdata) version = 4 flags = $wdata->flags - count = $wdata->args->count + count = @_nfs_data_args_count($wdata) offset = $wdata->args->offset bitmask0 = __nfsv4_bitmask($wdata->inode, 0) bitmask1 = __nfsv4_bitmask($wdata->inode, 1) @@ -625,11 +557,11 @@ probe nfs.proc3.commit = kernel.function ("nfs3_proc_commit") !, module("nfs").function("nfs3_proc_commit") ?, module("nfsv3").function("nfs3_proc_commit") ? { - server_ip = __nfs_write_data_info($cdata, 0) - prot = __nfs_write_data_info($cdata, 1) + server_ip = @_nfs_data_server_ip($cdata) + prot = @_nfs_data_prot($cdata) version = 3 - count = $cdata->args->count + count = @_nfs_data_args_count($cdata) offset = $cdata->args->offset bitmask0 = 0 bitmask1 = 0 @@ -661,11 +593,11 @@ probe nfs.proc4.commit = kernel.function ("nfs4_proc_commit") !, module("nfs").function("nfs4_proc_commit") ?, module("nfsv4").function("nfs4_proc_commit") ? { - server_ip = __nfs_write_data_info($cdata, 0) - prot = __nfs_write_data_info($cdata, 1) + server_ip = @_nfs_data_server_ip($cdata) + prot = @_nfs_data_prot($cdata) version = 4 - count = $cdata->args->count + count = @_nfs_data_args_count($cdata) offset = $cdata->args->offset bitmask0 = __nfsv4_bitmask($cdata->inode, 0) bitmask1 = __nfsv4_bitmask($cdata->inode, 1) @@ -727,7 +659,7 @@ probe nfs.proc2.read_setup = kernel.function("nfs_proc_read_setup") !, prot = get_prot_from_client(client) version = 2 - count = $data->args->count + count = @_nfs_data_args_count($data) offset = $data->args->offset name = "nfs.proc2.read_setup" @@ -758,7 +690,7 @@ probe nfs.proc3.read_setup = kernel.function("nfs3_proc_read_setup") !, version = 3 fh = - count = $data->args->count + count = @_nfs_data_args_count($data) offset = $data->args->offset name = "nfs.proc3.read_setup" @@ -788,7 +720,7 @@ probe nfs.proc4.read_setup = kernel.function("nfs4_proc_read_setup") !, prot = get_prot_from_client(client) version = 4 - count = $data->args->count + count = @_nfs_data_args_count($data) offset = $data->args->offset //timestamp = $jiffies @@ -836,14 +768,14 @@ probe nfs.proc2.read_done = kernel.function("nfs_read_done") !, module("nfsv2").function("nfs_read_done") ? { if (@defined($data)) { # kernels >= 2.6.10 - server_ip = __nfs_read_data_info($data, 0) - prot = __nfs_read_data_info($data, 1) - count = __nfs_read_data_info($data, 2) + server_ip = @_nfs_data_server_ip($data) + prot = @_nfs_data_prot($data) + count = @_nfs_data_res_count($data) } else { - server_ip = __nfs_read_data_info($task->tk_calldata, 0) - prot = __nfs_read_data_info($task->tk_calldata, 1) - count = __nfs_read_data_info($task->tk_calldata, 2) + server_ip = @_nfs_data_server_ip($task->tk_calldata) + prot = @_nfs_data_prot($task->tk_calldata) + count = @_nfs_data_res_count($task->tk_calldata) } timestamp = 0 version = 2 @@ -870,14 +802,14 @@ probe nfs.proc3.read_done = kernel.function("nfs3_read_done") !, module("nfsv3").function("nfs3_read_done") ? { if (@defined($data)) { # kernels >= 2.6.10 - server_ip = __nfs_read_data_info($data, 0) - prot = __nfs_read_data_info($data, 1) - count = __nfs_read_data_info($data, 2) + server_ip = @_nfs_data_server_ip($data) + prot = @_nfs_data_prot($data) + count = @_nfs_data_res_count($data) } else { - server_ip = __nfs_read_data_info($task->tk_calldata, 0) - prot = __nfs_read_data_info($task->tk_calldata, 1) - count = __nfs_read_data_info($task->tk_calldata, 2) + server_ip = @_nfs_data_server_ip($task->tk_calldata) + prot = @_nfs_data_prot($task->tk_calldata) + count = @_nfs_data_res_count($task->tk_calldata) } timestamp = 0 version = 3 @@ -904,16 +836,16 @@ probe nfs.proc4.read_done = kernel.function("nfs4_read_done") !, module("nfsv4").function("nfs4_read_done") ? { if (@defined($data)) { # kernels >= 2.6.10 - server_ip = __nfs_read_data_info($data, 0) - prot = __nfs_read_data_info($data, 1) - count = __nfs_read_data_info($data, 2) - timestamp = __nfs_read_data_info($data, 4) + server_ip = @_nfs_data_server_ip($data) + prot = @_nfs_data_prot($data) + count = @_nfs_data_res_count($data) + timestamp = @_nfs_data_timestamp($data) } else { - server_ip = __nfs_read_data_info($task->tk_calldata, 0) - prot = __nfs_read_data_info($task->tk_calldata, 1) - count = __nfs_read_data_info($task->tk_calldata, 2) - timestamp = __nfs_read_data_info($task->tk_calldata, 4) + server_ip = @_nfs_data_server_ip($task->tk_calldata) + prot = @_nfs_data_prot($task->tk_calldata) + count = @_nfs_data_res_count($task->tk_calldata) + timestamp = @_nfs_data_timestamp($task->tk_calldata) } version = 4 status = $task->tk_status @@ -974,7 +906,7 @@ probe nfs.proc2.write_setup = kernel.function("nfs_proc_write_setup") !, prot = get_prot_from_client(client) version = 2 - count = $data->args->count + count = @_nfs_data_args_count($data) offset = $data->args->offset how = @choose_defined($how, $data->args->stable) bitmask0 = 0 @@ -1008,7 +940,7 @@ probe nfs.proc3.write_setup = prot = get_prot_from_client(client) version = 3 - count = $data->args->count + count = @_nfs_data_args_count($data) offset = $data->args->offset how = @choose_defined($how, $data->args->stable) bitmask0 = 0 @@ -1041,7 +973,7 @@ probe nfs.proc4.write_setup = prot = get_prot_from_client(client) version = 4 - count = $data->args->count + count = @_nfs_data_args_count($data) offset = $data->args->offset how = @choose_defined($how, $data->args->stable) bitmask0 = __nfsv4_bitmask(inode, 0) @@ -1094,16 +1026,16 @@ probe nfs.proc2.write_done = kernel.function("nfs_write_done") !, module("nfsv2").function("nfs_write_done") ? { if (@defined($data)) { # kernels >= 2.6.10 - server_ip = __nfs_write_data_info($data, 0) - prot = __nfs_write_data_info($data, 1) - count = __nfs_write_data_info($data, 2) - valid = __nfs_write_data_info($data, 3) + server_ip = @_nfs_data_server_ip($data) + prot = @_nfs_data_prot($data) + count = @_nfs_data_res_count($data) + valid = @_nfs_data_valid($data) } else { - server_ip = __nfs_write_data_info($task->tk_calldata, 0) - prot = __nfs_write_data_info($task->tk_calldata, 1) - count = __nfs_write_data_info($task->tk_calldata, 2) - valid = __nfs_write_data_info($task->tk_calldata, 3) + server_ip = @_nfs_data_server_ip($task->tk_calldata) + prot = @_nfs_data_prot($task->tk_calldata) + count = @_nfs_data_res_count($task->tk_calldata) + valid = @_nfs_data_valid($task->tk_calldata) } timestamp = 0 version = 2 @@ -1128,16 +1060,16 @@ probe nfs.proc3.write_done = kernel.function("nfs3_write_done") !, module("nfsv3").function("nfs3_write_done") ? { if (@defined($data)) { # kernels >= 2.6.10 - server_ip = __nfs_write_data_info($data, 0) - prot = __nfs_write_data_info($data, 1) - count = __nfs_write_data_info($data, 2) - valid = __nfs_write_data_info($data, 3) + server_ip = @_nfs_data_server_ip($data) + prot = @_nfs_data_prot($data) + count = @_nfs_data_res_count($data) + valid = @_nfs_data_valid($data) } else { - server_ip = __nfs_write_data_info($task->tk_calldata, 0) - prot = __nfs_write_data_info($task->tk_calldata, 1) - count = __nfs_write_data_info($task->tk_calldata, 2) - valid = __nfs_write_data_info($task->tk_calldata, 3) + server_ip = @_nfs_data_server_ip($task->tk_calldata) + prot = @_nfs_data_prot($task->tk_calldata) + count = @_nfs_data_res_count($task->tk_calldata) + valid = @_nfs_data_valid($task->tk_calldata) } timestamp = 0 version = 3 @@ -1162,18 +1094,18 @@ probe nfs.proc4.write_done = kernel.function("nfs4_write_done") !, module("nfsv4").function("nfs4_write_done") ? { if (@defined($data)) { # kernels >= 2.6.10 - server_ip = __nfs_write_data_info($data, 0) - prot = __nfs_write_data_info($data, 1) - count = __nfs_write_data_info($data, 2) - valid = __nfs_write_data_info($data, 3) - timestamp = __nfs_write_data_info($data, 4) + server_ip = @_nfs_data_server_ip($data) + prot = @_nfs_data_prot($data) + count = @_nfs_data_res_count($data) + valid = @_nfs_data_valid($data) + timestamp = @_nfs_data_timestamp($data) } else { - server_ip = __nfs_write_data_info($task->tk_calldata, 0) - prot = __nfs_write_data_info($task->tk_calldata, 1) - count = __nfs_write_data_info($task->tk_calldata, 2) - valid = __nfs_write_data_info($task->tk_calldata, 3) - timestamp = __nfs_write_data_info($task->tk_calldata, 4) + server_ip = @_nfs_data_server_ip($task->tk_calldata) + prot = @_nfs_data_prot($task->tk_calldata) + count = @_nfs_data_res_count($task->tk_calldata) + valid = @_nfs_data_valid($task->tk_calldata) + timestamp = @_nfs_data_timestamp($task->tk_calldata) } version = 4 status = $task->tk_status @@ -1232,7 +1164,8 @@ probe nfs.proc3.commit_setup = prot = get_prot_from_client(client) version = 3 - count = $data->args->count + count = @_nfs_data_args_count($data) + offset = $data->args->offset bitmask0 = 0 bitmask1 = 0 @@ -1264,7 +1197,7 @@ probe nfs.proc4.commit_setup = prot = get_prot_from_client(client) version = 4 - count = $data->args->count + count = @_nfs_data_args_count($data) offset = $data->args->offset bitmask0 = __nfsv4_bitmask(inode, 0) bitmask1 = __nfsv4_bitmask(inode, 1) @@ -1315,16 +1248,16 @@ probe nfs.proc3.commit_done = kernel.function("nfs3_commit_done") !, module("nfsv3").function("nfs3_commit_done") ? { if (@defined($data)) { # kernels >= 2.6.10 - server_ip = __nfs_write_data_info($data, 0) - prot = __nfs_write_data_info($data, 1) - count = __nfs_write_data_info($data, 2) - valid = __nfs_write_data_info($data, 3) + server_ip = @_nfs_data_server_ip($data) + prot = @_nfs_data_prot($data) + count = @_nfs_data_res_count($data) + valid = @_nfs_data_valid($data) } else { - server_ip = __nfs_write_data_info($task->tk_calldata, 0) - prot = __nfs_write_data_info($task->tk_calldata, 1) - count = __nfs_write_data_info($task->tk_calldata, 2) - valid = __nfs_write_data_info($task->tk_calldata, 3) + server_ip = @_nfs_data_server_ip($task->tk_calldata) + prot = @_nfs_data_prot($task->tk_calldata) + count = @_nfs_data_res_count($task->tk_calldata) + valid = @_nfs_data_valid($task->tk_calldata) } timestamp = 0 version = 3 @@ -1349,18 +1282,18 @@ probe nfs.proc4.commit_done = kernel.function("nfs4_commit_done") !, module("nfsv4").function("nfs4_commit_done") ? { if (@defined($data)) { # kernels >= 2.6.10 - server_ip = __nfs_write_data_info($data, 0) - prot = __nfs_write_data_info($data, 1) - count = __nfs_write_data_info($data, 2) - valid = __nfs_write_data_info($data, 3) - timestamp = __nfs_write_data_info($data, 4) + server_ip = @_nfs_data_server_ip($data) + prot = @_nfs_data_prot($data) + count = @_nfs_data_res_count($data) + valid = @_nfs_data_valid($data) + timestamp = @_nfs_data_timestamp($data) } else { - server_ip = __nfs_write_data_info($task->tk_calldata, 0) - prot = __nfs_write_data_info($task->tk_calldata, 1) - count = __nfs_write_data_info($task->tk_calldata, 2) - valid = __nfs_write_data_info($task->tk_calldata, 3) - timestamp = __nfs_write_data_info($task->tk_calldata, 4) + server_ip = @_nfs_data_server_ip($task->tk_calldata) + prot = @_nfs_data_prot($task->tk_calldata) + count = @_nfs_data_res_count($task->tk_calldata) + valid = @_nfs_data_valid($task->tk_calldata) + timestamp = @_nfs_data_timestamp($task->tk_calldata) } version = 4 status = $task->tk_status @@ -1394,8 +1327,9 @@ probe nfs.proc4.commit_done.return = probe nfs.proc.open = kernel.function("nfs_open") !, module("nfs").function("nfs_open") ? { - server_ip = __i2n_ip_proto($inode, 0) - prot = __i2n_ip_proto($inode, 1) + client = NFS_CLIENT($inode) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = __nfs_version($inode) filename = __file_filename($filp) @@ -1428,8 +1362,9 @@ probe nfs.proc.open.return = kernel.function("nfs_open").return !, probe nfs.proc.release = kernel.function("nfs_release") !, module("nfs").function("nfs_release") ? { - server_ip = __i2n_ip_proto($inode, 0) - prot = __i2n_ip_proto($inode, 1) + client = NFS_CLIENT($inode) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = __nfs_version($inode) filename = __file_filename($filp) @@ -1507,8 +1442,9 @@ probe nfs.proc2.create = kernel.function("nfs_proc_create") !, module("nfs").function("nfs_proc_create") ?, module("nfsv2").function("nfs_proc_create") ? { - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 2 fh = NFS_FH($dir) @@ -1534,8 +1470,9 @@ probe nfs.proc3.create = kernel.function("nfs3_proc_create") !, module("nfs").function("nfs3_proc_create") ?, module("nfsv3").function("nfs3_proc_create") ? { - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 3 fh = NFS_FH($dir) @@ -1562,8 +1499,9 @@ probe nfs.proc4.create = kernel.function("nfs4_proc_create") !, module("nfs").function("nfs4_proc_create") ?, module("nfsv4").function("nfs4_proc_create") ? { - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 4 fh = NFS_FH($dir) @@ -1610,8 +1548,9 @@ probe nfs.proc2.remove = kernel.function("nfs_proc_remove") !, module("nfs").function("nfs_proc_remove") ?, module("nfsv2").function("nfs_proc_remove") ? { - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 2 fh = NFS_FH($dir) @@ -1636,8 +1575,9 @@ probe nfs.proc3.remove = kernel.function("nfs3_proc_remove") !, module("nfs").function("nfs3_proc_remove") ?, module("nfsv3").function("nfs3_proc_remove") ? { - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 3 fh = NFS_FH($dir) @@ -1662,8 +1602,9 @@ probe nfs.proc4.remove = kernel.function("nfs4_proc_remove") !, module("nfs").function("nfs4_proc_remove") ?, module("nfsv4").function("nfs4_proc_remove") ? { - server_ip = __i2n_ip_proto($dir, 0) - prot = __i2n_ip_proto($dir, 1) + client = NFS_CLIENT($dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 4 fh = NFS_FH($dir) @@ -1711,8 +1652,9 @@ probe nfs.proc2.rename = kernel.function("nfs_proc_rename") !, module("nfs").function("nfs_proc_rename") ?, module("nfsv2").function("nfs_proc_rename") ? { - server_ip = __i2n_ip_proto($old_dir, 0) - prot = __i2n_ip_proto($old_dir, 1) + client = NFS_CLIENT($old_dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 2 old_fh = NFS_FH($old_dir) @@ -1740,8 +1682,9 @@ probe nfs.proc3.rename = kernel.function("nfs3_proc_rename") !, module("nfs").function("nfs3_proc_rename") ?, module("nfsv3").function("nfs3_proc_rename") ? { - server_ip = __i2n_ip_proto($old_dir, 0) - prot = __i2n_ip_proto($old_dir, 1) + client = NFS_CLIENT($old_dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 3 old_fh = NFS_FH($old_dir) @@ -1769,8 +1712,9 @@ probe nfs.proc4.rename = kernel.function("nfs4_proc_rename") !, module("nfs").function("nfs4_proc_rename") ?, module("nfsv4").function("nfs4_proc_rename") ? { - server_ip = __i2n_ip_proto($old_dir, 0) - prot = __i2n_ip_proto($old_dir, 1) + client = NFS_CLIENT($old_dir) + server_ip = get_ip_from_client(client) + prot = get_prot_from_client(client) version = 4 old_fh = NFS_FH($old_dir) diff --git a/tapset/linux/nfs_proc.stpm b/tapset/linux/nfs_proc.stpm new file mode 100644 index 000000000..8576c0f33 --- /dev/null +++ b/tapset/linux/nfs_proc.stpm @@ -0,0 +1,46 @@ +// macros for nfs_proc.stp (the NFS procedure tapset) +// Copyright (C) 2013 Red Hat +// +// This file is part of systemtap, and is free software. You can +// redistribute it and/or modify it under the terms of the GNU General +// Public License (GPL); either version 2, or (at your option) any +// later version. + +// Macros to return data from a 'struct nfs_read_data', 'struct +// nfs_write_data', or 'struct nfs_commit_data'. Even though the +// structures are laid out differently, since the names of the fields +// are the same, one set of macros can work for all types. + +@define _nfs_data_server_ip(nfs_data) +%( + ( get_ip(&@nfs_data->task) ) +%) + +@define _nfs_data_prot(nfs_data) +%( + ( get_prot(&@nfs_data->task) ) +%) + +@define _nfs_data_args_count(nfs_data) +%( + ( @nfs_data->args->count ) +%) + +// The 'nfs_commitres' structure has no 'count' field. +@define _nfs_data_res_count(nfs_data) +%( + ( @choose_defined(@nfs_data->res->count, 0) ) +%) + +@define _nfs_data_valid(nfs_data) +%( + ( @nfs_data->res->fattr->valid ) +%) + +// The 'nfs_commit_data' structure has no 'timestamp' field. +@define _nfs_data_timestamp(nfs_data) +%( + ( %( CONFIG_NFS_V4 == "[ym]" + %? @choose_defined(@nfs_data->timestamp, 0) + %: 0 %) ) +%) -- 2.43.5