NFSv4 add debugging tracepoints
Subsystems (2)
PATCH v2 2/13 NFS: refactor code for calculating the crc32 hash of a filehandle
In reply to Trond MyklebustWe want to be able to display the crc32 hash of the filehandle in tracepoints.
--- fs/nfs/inode.c | 3 +-- fs/nfs/internal.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-)
fs/nfs/inode.c +1 -2
@@ -38,7 +38,6 @@#include <linux/slab.h> #include <linux/compat.h> #include <linux/freezer.h> -#include <linux/crc32.h> #include <asm/uaccess.h>
@@ -1190,7 +1189,7 @@ u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh) {/* wireshark uses 32-bit AUTODIN crc and does a bitwise * not on the result */ -return ~crc32 (0xFFFFFFFF , &fh->data[0 ], fh->size); +return nfs_fhandle_hash (fh); }/*
fs/nfs/internal.h +20 -0
@@ -5,6 +5,7 @@#include "nfs4_fs.h" #include <linux/mount.h> #include <linux/security.h> +#include <linux/crc32.h> #define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS)
@@ -574,3 +575,22 @@ u64 nfs_timespec_to_change_attr(const struct timespec *ts) {return ((u64 )ts->tv_sec <<30 ) + ts->tv_nsec; } + +#ifdef CONFIG_CRC32 +/** +* nfs_fhandle_hash - calculate the crc32 hash for the filehandle +* @fh - pointer to filehandle +* +* returns a crc32 hash for the filehandle that is compatible with +* the one displayed by "wireshark". +*/ +static inline u32 nfs_fhandle_hash (const struct nfs_fh *fh) +{ +return ~crc32_le (0xFFFFFFFF , &fh->data[0 ], fh->size); +} +#else +static inline u32 nfs_fhandle_hash (const struct nfs_fh *fh) +{ +return 0 ; +} +#endif
Signature · 1 line
1.8.3.1
PATCH v2 3/13 NFSv4: Add tracepoints for debugging file open
Set up basic tracepoints for debugging NFSv4 file open/close
--- fs/nfs/nfs4proc.c | 4 ++ fs/nfs/nfs4trace.h | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+)
fs/nfs/nfs4proc.c +4 -0
@@ -1442,6 +1442,7 @@ static int nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_stateint err; do { err = _nfs4_do_open_reclaim(ctx, state); + trace_nfs4_open_reclaim(ctx, state, 0, err); if (nfs4_clear_cap_atomic_open_v1(server, err, &exception)) continue; if (err != -NFS4ERR_DELAY)
@@ -1897,6 +1898,7 @@ static int nfs4_do_open_expired(struct nfs_open_context *ctx, struct nfs4_state do { err = _nfs4_open_expired(ctx, state); + trace_nfs4_open_expired(ctx, state, 0, err); if (nfs4_clear_cap_atomic_open_v1(server, err, &exception)) continue; switch (err) {
@@ -2199,6 +2201,7 @@ static struct nfs4_state *nfs4_do_open(struct inode *dir, do { status = _nfs4_do_open(dir, ctx, flags, sattr, label); res = ctx->state; + trace_nfs4_open_file(ctx, res, flags, status); if (status == 0) break; /* NOTE: BAD_SEQID means the server and client disagree about the
@@ -2389,6 +2392,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)dprintk ("%s: begin!\n" , __func__);if (!nfs4_sequence_done (task, &calldata->res.seq_res))return ; +trace_nfs4_close (state, calldata->arg.fmode, task->tk_status);/* hmm. we are done with the inode, and in the process of freeing * the state_owner. we keep this around to process errors */
fs/nfs/nfs4trace.h +112 -0
124 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 5/13 NFSv4: Add tracepoints for debugging lookup/create operations
In reply to Trond MyklebustSet up basic tracepoints for debugging NFSv4 lookup, unlink/remove, symlink, mkdir, mknod, fs_locations and secinfo.
--- fs/nfs/nfs4proc.c | 37 +++++++++++++++++++++++-------------- fs/nfs/nfs4trace.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 14 deletions(-)
fs/nfs/nfs4proc.c +23 -14
@@ -3026,6 +3026,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,int err; do { err = _nfs4_proc_lookup(client, dir, name, fhandle, fattr, label); + trace_nfs4_lookup(dir, name, err); switch (err) { case -NFS4ERR_BADNAME: err = -ENOENT;
@@ -3261,8 +3262,9 @@ static int nfs4_proc_remove(struct inode *dir, struct qstr *name)struct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (NFS_SERVER (dir), -_nfs4_proc_remove (dir, name), + err =_nfs4_proc_remove (dir, name); +trace_nfs4_remove (dir, name, err); + err =nfs4_handle_exception (NFS_SERVER (dir), err, &exception); }while (exception.retry);return err;
@@ -3291,10 +3293,12 @@ static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinstatic int nfs4_proc_unlink_done (struct rpc_task *task,struct inode *dir) { -struct nfs_removeres *res = task->tk_msg.rpc_resp; +struct nfs_unlinkdata *data = task->tk_calldata; +struct nfs_removeres *res = &data->res;if (!nfs4_sequence_done (task, &res->seq_res))return 0 ; +trace_nfs4_remove_async (dir, &data->args.name, task->tk_status);if (nfs4_async_handle_error (task, res->server,NULL ) == -EAGAIN )return 0 ;update_changeattr (dir, &res->cinfo);
@@ -3533,9 +3537,9 @@ static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, label =nfs4_label_init_security (dir, dentry, sattr, &l);do { - err =nfs4_handle_exception (NFS_SERVER (dir), -_nfs4_proc_symlink (dir, dentry, page, - len, sattr, label), + err =_nfs4_proc_symlink (dir, dentry, page, len, sattr, label); +trace_nfs4_symlink (dir, &dentry->d_name, err); + err =nfs4_handle_exception (NFS_SERVER (dir), err, &exception); }while (exception.retry);
@@ -3572,8 +3576,9 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, sattr->ia_mode &= ~current_umask ();do { - err =nfs4_handle_exception (NFS_SERVER (dir), -_nfs4_proc_mkdir (dir, dentry, sattr, label), + err =_nfs4_proc_mkdir (dir, dentry, sattr, label); +trace_nfs4_mkdir (dir, &dentry->d_name, err); + err =nfs4_handle_exception (NFS_SERVER (dir), err, &exception); }while (exception.retry);nfs4_label_release_security (label);
@@ -3680,8 +3685,9 @@ static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, sattr->ia_mode &= ~current_umask ();do { - err =nfs4_handle_exception (NFS_SERVER (dir), -_nfs4_proc_mknod (dir, dentry, sattr, label, rdev), + err =_nfs4_proc_mknod (dir, dentry, sattr, label, rdev); +trace_nfs4_mknod (dir, &dentry->d_name, err); + err =nfs4_handle_exception (NFS_SERVER (dir), err, &exception); }while (exception.retry);
@@ -5801,8 +5807,10 @@ int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,struct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (NFS_SERVER (dir), -_nfs4_proc_fs_locations (client, dir, name, fs_locations, page), + err =_nfs4_proc_fs_locations (client, dir, name, + fs_locations, page); +trace_nfs4_get_fs_locations (dir, name, err); + err =nfs4_handle_exception (NFS_SERVER (dir), err, &exception); }while (exception.retry);return err;
@@ -5836,8 +5844,9 @@ int nfs4_proc_secinfo(struct inode *dir, const struct qstr *name,struct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (NFS_SERVER (dir), -_nfs4_proc_secinfo (dir, name, flavors), + err =_nfs4_proc_secinfo (dir, name, flavors); +trace_nfs4_secinfo (dir, name, err); + err =nfs4_handle_exception (NFS_SERVER (dir), err, &exception); }while (exception.retry);return err;
fs/nfs/nfs4trace.h +46 -0
52 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 7/13 NFSv4: Add tracepoints for debugging rename
In reply to Trond MyklebustAdd tracepoints to debug both synchronous and asynchronous renames.
--- fs/nfs/nfs4proc.c | 13 +++++++++---- fs/nfs/nfs4trace.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 4 deletions(-)
fs/nfs/nfs4proc.c +9 -4
@@ -3330,10 +3330,14 @@ static void nfs4_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamstatic int nfs4_proc_rename_done (struct rpc_task *task,struct inode *old_dir,struct inode *new_dir) { -struct nfs_renameres *res = task->tk_msg.rpc_resp; +struct nfs_renamedata *data = task->tk_calldata; +struct nfs_renameres *res = &data->res;if (!nfs4_sequence_done (task, &res->seq_res))return 0 ; +trace_nfs4_rename_async (old_dir, data->args.old_name, + new_dir, data->args.new_name, + task->tk_status);if (nfs4_async_handle_error (task, res->server,NULL ) == -EAGAIN )return 0 ;
@@ -3376,9 +3380,10 @@ static int nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,struct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (NFS_SERVER (old_dir), -_nfs4_proc_rename (old_dir, old_name, - new_dir, new_name), + err =_nfs4_proc_rename (old_dir, old_name, + new_dir, new_name); +trace_nfs4_rename (old_dir, old_name, new_dir, new_name, err); + err =nfs4_handle_exception (NFS_SERVER (old_dir), err, &exception); }while (exception.retry);return err;
fs/nfs/nfs4trace.h +50 -0
56 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 8/13 NFSv4: Add tracepoints for debugging delegations
Set up tracepoints to track when delegations are set, reclaimed, returned by the client, or recalled by the server.
--- fs/nfs/callback_proc.c | 2 ++ fs/nfs/delegation.c | 3 +++ fs/nfs/nfs4proc.c | 1 + fs/nfs/nfs4trace.h | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+)
fs/nfs/callback_proc.c +2 -0
@@ -15,6 +15,7 @@#include "internal.h" #include "pnfs.h" #include "nfs4session.h" +#include "nfs4trace.h" #ifdef NFS_DEBUG #define NFSDBG_FACILITY NFSDBG_CALLBACK
@@ -93,6 +94,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy,default : res =htonl (NFS4ERR_RESOURCE ); } +trace_nfs4_recall_delegation (inode, -ntohl (res));iput (inode); out:dprintk ("%s: exit with status = %d\n" , __func__,ntohl (res));
fs/nfs/delegation.c +3 -0
@@ -20,6 +20,7 @@#include "nfs4_fs.h" #include "delegation.h" #include "internal.h" +#include "nfs4trace.h" static void nfs_free_delegation (struct nfs_delegation *delegation) {
@@ -160,6 +161,7 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,spin_unlock (&delegation->lock);put_rpccred (oldcred);rcu_read_unlock (); +trace_nfs4_reclaim_delegation (inode, res->delegation_type); }else {/* We appear to have raced with a delegation return. */ spin_unlock (&delegation->lock);
@@ -344,6 +346,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, structspin_lock (&inode->i_lock); nfsi->cache_validity |=NFS_INO_REVAL_FORCED ;spin_unlock (&inode->i_lock); +trace_nfs4_set_delegation (inode, res->delegation_type); out:spin_unlock (&clp->cl_lock);
fs/nfs/nfs4proc.c +1 -0
@@ -4909,6 +4909,7 @@ int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4int err; do { err = _nfs4_proc_delegreturn(inode, cred, stateid, issync); + trace_nfs4_delegreturn(inode, err); switch (err) { case -NFS4ERR_STALE_STATEID: case -NFS4ERR_EXPIRED:
fs/nfs/nfs4trace.h +37 -0
@@ -391,6 +391,41 @@ DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim);DEFINE_NFS4_LOCK_EVENT (nfs4_lock_expired);DEFINE_NFS4_LOCK_EVENT (nfs4_unlock); +DECLARE_EVENT_CLASS (nfs4_set_delegation_event, + TP_PROTO(const struct inode *inode, + fmode_t fmode), + +TP_ARGS (inode, fmode), + +TP_STRUCT__entry ( + __field(dev_t, dev) + __field(u32, fhandle) + __field(u64, fileid) +__field (fmode_t, fmode) + ), + +TP_fast_assign ( + __entry->dev = inode->i_sb->s_dev; + __entry->fileid = NFS_FILEID(inode); + __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); + __entry->fmode = fmode; + ), + +TP_printk ("mode=%s fileid=%02x:%02x:%lld, fhandle=%0x08x" , +show_fmode_flags (__entry->fmode), +MAJOR (__entry->dev),MINOR (__entry->dev), + (unsigned long long )__entry->fileid, + __entry->fhandle + ) +); +#define DEFINE_NFS4_SET_DELEGATION_EVENT (name) \ +DEFINE_EVENT(nfs4_set_delegation_event, name, \ + TP_PROTO(const struct inode *inode, \ + fmode_t fmode), \ + TP_ARGS(inode, fmode)) +DEFINE_NFS4_SET_DELEGATION_EVENT (nfs4_set_delegation); +DEFINE_NFS4_SET_DELEGATION_EVENT (nfs4_reclaim_delegation); + DECLARE_EVENT_CLASS(nfs4_lookup_event, TP_PROTO(const struct inode *dir, const struct qstr *name,
@@ -532,6 +567,8 @@ DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);DEFINE_NFS4_INODE_EVENT (nfs4_get_security_label);DEFINE_NFS4_INODE_EVENT (nfs4_set_security_label);#endif /* CONFIG_NFS_V4_SECURITY_LABEL */ +DEFINE_NFS4_INODE_EVENT (nfs4_recall_delegation); +DEFINE_NFS4_INODE_EVENT (nfs4_delegreturn);#endif /* _TRACE_NFS4_H */
Signature · 1 line
1.8.3.1
PATCH v2 9/13 NFSv4: Add tracepoints for debugging the idmapper
Add tracepoints to help debug uid/gid mappings to username/group.
--- fs/nfs/idmap.c | 5 +++++ fs/nfs/nfs4trace.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+)
fs/nfs/idmap.c +5 -0
@@ -49,6 +49,7 @@#include "internal.h" #include "netns.h" +#include "nfs4trace.h" #define NFS_UINT_MAXLEN 11
@@ -849,6 +850,7 @@ int nfs_map_name_to_uid(const struct nfs_server *server, const char *name, size_if (!uid_valid (*uid)) ret = -ERANGE ; } +trace_nfs4_map_name_to_uid (name, namelen, id, ret);return ret; }
@@ -865,6 +867,7 @@ int nfs_map_group_to_gid(const struct nfs_server *server, const char *name, sizeif (!gid_valid (*gid)) ret = -ERANGE ; } +trace_nfs4_map_group_to_gid (name, namelen, id, ret);return ret; }
@@ -879,6 +882,7 @@ int nfs_map_uid_to_name(const struct nfs_server *server, kuid_t uid, char *buf, ret =nfs_idmap_lookup_name (id,"user" , buf, buflen, idmap);if (ret <0 ) ret =nfs_map_numeric_to_string (id, buf, buflen); +trace_nfs4_map_uid_to_name (buf, ret, id, ret);return ret; }int nfs_map_gid_to_group (const struct nfs_server *server,kgid_t gid,char *buf,size_t buflen)
@@ -892,5 +896,6 @@ int nfs_map_gid_to_group(const struct nfs_server *server, kgid_t gid, char *buf, ret =nfs_idmap_lookup_name (id,"group" , buf, buflen, idmap);if (ret <0 ) ret =nfs_map_numeric_to_string (id, buf, buflen); +trace_nfs4_map_gid_to_group (buf, ret, id, ret);return ret; }
fs/nfs/nfs4trace.h +41 -0
47 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 11/13 NFSv4: Add tracepoints for debugging reads and writes
In reply to Trond MyklebustSet up tracepoints to track read, write and commit, as well as pNFS reads and writes and commits to the data server.
--- fs/nfs/nfs4filelayout.c | 10 +++++ fs/nfs/nfs4proc.c | 8 ++++ fs/nfs/nfs4trace.c | 5 +++ fs/nfs/nfs4trace.h | 104 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.c | 7 ++++ 5 files changed, 134 insertions(+)
fs/nfs/nfs4filelayout.c +10 -0
@@ -39,6 +39,7 @@#include "internal.h" #include "delegation.h" #include "nfs4filelayout.h" +#include "nfs4trace.h" #define NFSDBG_FACILITY NFSDBG_PNFS_LD
@@ -273,6 +274,9 @@ static int filelayout_read_done_cb(struct rpc_task *task,struct nfs_pgio_header *hdr = data->header;int err; +trace_nfs4_pnfs_read (hdr, data->args.context, + data->args.offset, data->args.count, + task->tk_status); err =filelayout_async_handle_error (task, data->args.context->state, data->ds_clp, hdr->lseg);
@@ -389,6 +393,9 @@ static int filelayout_write_done_cb(struct rpc_task *task,struct nfs_pgio_header *hdr = data->header;int err; +trace_nfs4_pnfs_write (hdr, data->args.context, + data->args.offset, data->args.count, + task->tk_status); err =filelayout_async_handle_error (task, data->args.context->state, data->ds_clp, hdr->lseg);
@@ -421,6 +428,9 @@ static int filelayout_commit_done_cb(struct rpc_task *task, {int err; +trace_nfs4_pnfs_commit_ds (data->inode, + data->args.offset, data->args.count, + task->tk_status); err =filelayout_async_handle_error (task,NULL , data->ds_clp, data->lseg);
fs/nfs/nfs4proc.c +8 -0
@@ -3885,6 +3885,9 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_read_data *data) {struct nfs_server *server =NFS_SERVER (data->header->inode); +trace_nfs4_read (data->header, data->args.context, + data->args.offset, data->args.count, + task->tk_status);if (nfs4_async_handle_error (task, server, data->args.context->state) == -EAGAIN ) {rpc_restart_call_prepare (task);return -EAGAIN ;
@@ -3946,6 +3949,9 @@ static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data {struct inode *inode = data->header->inode; +trace_nfs4_write (data->header, data->args.context, + data->args.offset, data->args.count, + task->tk_status);if (nfs4_async_handle_error (task,NFS_SERVER (inode), data->args.context->state) == -EAGAIN ) {rpc_restart_call_prepare (task);return -EAGAIN ;
@@ -4037,6 +4043,8 @@ static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_commit_data *da {struct inode *inode = data->inode; +trace_nfs4_commit (inode, data->args.offset, data->args.count, + task->tk_status);if (nfs4_async_handle_error (task,NFS_SERVER (inode),NULL ) == -EAGAIN ) {rpc_restart_call_prepare (task);return -EAGAIN ;
fs/nfs/nfs4trace.c +5 -0
@@ -8,3 +8,8 @@#define CREATE_TRACE_POINTS #include "nfs4trace.h" +#ifdef CONFIG_NFS_V4_1 +EXPORT_TRACEPOINT_SYMBOL_GPL (nfs4_pnfs_read); +EXPORT_TRACEPOINT_SYMBOL_GPL (nfs4_pnfs_write); +EXPORT_TRACEPOINT_SYMBOL_GPL (nfs4_pnfs_commit_ds); +#endif
fs/nfs/nfs4trace.h +104 -0
110 lines not on this page · raw message
fs/nfs/pnfs.c +7 -0
@@ -33,6 +33,7 @@#include "internal.h" #include "pnfs.h" #include "iostat.h" +#include "nfs4trace.h" #define NFSDBG_FACILITY NFSDBG_PNFS#define PNFS_LAYOUTGET_RETRY_TIMEOUT (120*HZ)
@@ -1551,6 +1552,9 @@ void pnfs_ld_write_done(struct nfs_write_data *data) {struct nfs_pgio_header *hdr = data->header; +trace_nfs4_pnfs_write (hdr, data->args.context, + data->args.offset, data->args.count, + hdr->pnfs_error);if (!hdr->pnfs_error) {pnfs_set_layoutcommit (data); hdr->mds_ops->rpc_call_done (&data->task, data);
@@ -1705,6 +1709,9 @@ void pnfs_ld_read_done(struct nfs_read_data *data) {struct nfs_pgio_header *hdr = data->header; +trace_nfs4_pnfs_write (hdr, data->args.context, + data->args.offset, data->args.count, + hdr->pnfs_error);if (likely (!hdr->pnfs_error)) {__nfs4_read_done_cb (data); hdr->mds_ops->rpc_call_done (&data->task, data);
Signature · 1 line
1.8.3.1
PATCH v2 10/13 NFSv4: Add tracepoints for debugging getattr
In reply to Trond Myklebust--- fs/nfs/nfs4proc.c | 7 ++++-- fs/nfs/nfs4trace.h | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +5 -2
@@ -2697,6 +2697,7 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,int err; do { err = _nfs4_lookup_root(server, fhandle, info); + trace_nfs4_lookup_root(server, fhandle, info->fattr, err); switch (err) { case 0: case -NFS4ERR_WRONGSEC:
@@ -2906,8 +2907,9 @@ static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,struct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (server, -_nfs4_proc_getattr (server, fhandle, fattr, label), + err =_nfs4_proc_getattr (server, fhandle, fattr, label); +trace_nfs4_getattr (server, fhandle, fattr, err); + err =nfs4_handle_exception (server, err, &exception); }while (exception.retry);return err;
@@ -3764,6 +3766,7 @@ static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, str do { err = _nfs4_do_fsinfo(server, fhandle, fsinfo); + trace_nfs4_fsinfo(server, fhandle, fsinfo->fattr, err); if (err == 0) { struct nfs_client *clp = server->nfs_client;
fs/nfs/nfs4trace.h +64 -0
76 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 13/13 NFSv4.1: Add tracepoints for debugging slot table operations
In reply to Trond MyklebustAdd tracepoints to nfs41_setup_sequence and nfs41_sequence_done to track session and slot table state changes.
--- fs/nfs/callback_proc.c | 1 + fs/nfs/nfs4proc.c | 2 + fs/nfs/nfs4session.h | 10 ++++ fs/nfs/nfs4trace.c | 2 + fs/nfs/nfs4trace.h | 130 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 145 insertions(+)
fs/nfs/callback_proc.c +1 -0
@@ -464,6 +464,7 @@ out: }else res->csr_status = status; +trace_nfs4_cb_sequence (args, res,htonl (status));dprintk ("%s: exit with status = %d res->csr_status %d\n" , __func__,ntohl (status),ntohl (res->csr_status));return status;
fs/nfs/nfs4proc.c +2 -0
@@ -508,6 +508,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res * interrupted = true; } +trace_nfs4_sequence_done (session, res);/* Check the SEQUENCE operation status */ switch (res->sr_status) {case 0 :
@@ -660,6 +661,7 @@ int nfs41_setup_sequence(struct nfs4_session *session,* set to 1 if an rpc level failure occurs. */ res->sr_status =1 ; +trace_nfs4_setup_sequence (session, args); out_success:rpc_call_start (task);return 0 ;
fs/nfs/nfs4session.h +10 -0
@@ -117,6 +117,16 @@ static inline int nfs4_has_persistent_session(const struct nfs_client *clp) return 0; } +#ifdef CONFIG_CRC32 +/* +* nfs_session_id_hash - calculate the crc32 hash for the session id +* @session - pointer to session +*/ +#define nfs_session_id_hash (sess_id) \ + (~crc32_le(0xFFFFFFFF, &(sess_id)->data[0], sizeof((sess_id)->data))) +#else +#define nfs_session_id_hash (session) (0) +#endif #else /* defined(CONFIG_NFS_V4_1) */ static inline int nfs4_init_session (struct nfs_client *clp)
fs/nfs/nfs4trace.c +2 -0
@@ -4,6 +4,8 @@#include <linux/nfs_fs.h> #include "nfs4_fs.h" #include "internal.h" +#include "nfs4session.h" +#include "callback.h" #define CREATE_TRACE_POINTS #include "nfs4trace.h"
fs/nfs/nfs4trace.h +130 -0
136 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 12/13 NFSv4.1: Add tracepoints for debugging layoutget/return/commit
In reply to Trond Myklebust--- fs/nfs/nfs4proc.c | 6 ++++++ fs/nfs/nfs4trace.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+)
fs/nfs/nfs4proc.c +6 -0
@@ -6863,6 +6863,10 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) status =nfs4_wait_for_completion_rpc_task (task);if (status ==0 ) status = task->tk_status; +trace_nfs4_layoutget (lgp->args.ctx, + &lgp->args.range, + &lgp->res.range, + status);/* if layoutp->len is 0, nfs4_layoutget_prepare called rpc_exit */ if (status ==0 && lgp->res.layoutp->len) lseg =pnfs_layout_process (lgp);
@@ -6948,6 +6952,7 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp)if (IS_ERR (task))return PTR_ERR (task); status = task->tk_status; +trace_nfs4_layoutreturn (lrp->args.inode, status);dprintk ("<-- %s status=%d\n" , __func__, status);rpc_put_task (task);return status;
@@ -7134,6 +7139,7 @@ nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, bool sync)if (status !=0 ) goto out; status = task->tk_status; +trace_nfs4_layoutcommit (data->args.inode, status); out:dprintk ("%s: status %d\n" , __func__, status);rpc_put_task (task);
fs/nfs/nfs4trace.h +51 -0
57 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 4/13 NFSv4: Add tracepoints for debugging file locking
In reply to Trond MyklebustSet up basic tracepoints for debugging NFSv4 file lock/unlock
--- fs/nfs/nfs4proc.c | 9 +++++-- fs/nfs/nfs4trace.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +7 -2
@@ -4964,8 +4964,9 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *int err;do { - err =nfs4_handle_exception (NFS_SERVER (state->inode), -_nfs4_proc_getlk (state, cmd, request), + err =_nfs4_proc_getlk (state, cmd, request); +trace_nfs4_get_lock (request, state, cmd, err); + err =nfs4_handle_exception (NFS_SERVER (state->inode), err, &exception); }while (exception.retry);return err;
@@ -5163,6 +5164,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *rpc_put_task (task); out: request->fl_flags = fl_flags; +trace_nfs4_unlock (request, state,F_SETLK , status);return status; }
@@ -5386,6 +5388,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *requestif (test_bit (NFS_DELEGATED_STATE , &state->flags) !=0 )return 0 ; err =_nfs4_do_setlk (state,F_SETLK , request,NFS_LOCK_RECLAIM ); +trace_nfs4_lock_reclaim (request, state,F_SETLK , err);if (err != -NFS4ERR_DELAY )break ;nfs4_handle_exception (server, err, &exception);
@@ -5408,6 +5411,7 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *requestif (test_bit (NFS_DELEGATED_STATE , &state->flags) !=0 )return 0 ; err =_nfs4_do_setlk (state,F_SETLK , request,NFS_LOCK_EXPIRED ); +trace_nfs4_lock_expired (request, state,F_SETLK , err);switch (err) {default : goto out;
@@ -5530,6 +5534,7 @@ static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock * do { err = _nfs4_proc_setlk(state, cmd, request); + trace_nfs4_set_lock(request, state, cmd, err); if (err == -NFS4ERR_DENIED) err = -EAGAIN; err = nfs4_handle_exception(NFS_SERVER(state->inode),
fs/nfs/nfs4trace.h +77 -0
83 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 6/13 NFSv4: Add tracepoints for debugging inode manipulations
In reply to Trond MyklebustSet up basic tracepoints for debugging NFSv4 setattr, access, readlink, readdir, get_acl set_acl get_security_label, and set_security_label.
--- fs/nfs/nfs4proc.c | 36 ++++++++++++++++++++++-------------- fs/nfs/nfs4trace.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 14 deletions(-)
fs/nfs/nfs4proc.c +22 -14
@@ -2315,6 +2315,7 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,int err; do { err = _nfs4_do_setattr(inode, cred, fattr, sattr, state, ilabel, olabel); + trace_nfs4_setattr(inode, err); switch (err) { case -NFS4ERR_OPENMODE: if (!(sattr->ia_valid & ATTR_SIZE)) {
@@ -3143,8 +3144,9 @@ static int nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)struct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (NFS_SERVER (inode), -_nfs4_proc_access (inode, entry), + err =_nfs4_proc_access (inode, entry); +trace_nfs4_access (inode, err); + err =nfs4_handle_exception (NFS_SERVER (inode), err, &exception); }while (exception.retry);return err;
@@ -3197,8 +3199,9 @@ static int nfs4_proc_readlink(struct inode *inode, struct page *page,struct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (NFS_SERVER (inode), -_nfs4_proc_readlink (inode, page, pgbase, pglen), + err =_nfs4_proc_readlink (inode, page, pgbase, pglen); +trace_nfs4_readlink (inode, err); + err =nfs4_handle_exception (NFS_SERVER (inode), err, &exception); }while (exception.retry);return err;
@@ -3631,9 +3634,10 @@ static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,struct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (NFS_SERVER (dentry->d_inode), -_nfs4_proc_readdir (dentry, cred, cookie, - pages, count, plus), + err =_nfs4_proc_readdir (dentry, cred, cookie, + pages, count, plus); +trace_nfs4_readdir (dentry->d_inode, err); + err =nfs4_handle_exception (NFS_SERVER (dentry->d_inode), err, &exception); }while (exception.retry);return err;
@@ -4334,6 +4338,7 @@ static ssize_t nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflssize_t ret; do { ret = __nfs4_get_acl_uncached(inode, buf, buflen); + trace_nfs4_get_acl(inode, ret); if (ret >= 0) break; ret = nfs4_handle_exception(NFS_SERVER(inode), ret, &exception);
@@ -4413,8 +4418,9 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflenstruct nfs4_exception exception = { };int err;do { - err =nfs4_handle_exception (NFS_SERVER (inode), -__nfs4_proc_set_acl (inode, buf, buflen), + err =__nfs4_proc_set_acl (inode, buf, buflen); +trace_nfs4_set_acl (inode, err); + err =nfs4_handle_exception (NFS_SERVER (inode), err, &exception); }while (exception.retry);return err;
@@ -4467,8 +4473,9 @@ static int nfs4_get_security_label(struct inode *inode, void *buf,return -EOPNOTSUPP ;do { - err =nfs4_handle_exception (NFS_SERVER (inode), -_nfs4_get_security_label (inode, buf, buflen), + err =_nfs4_get_security_label (inode, buf, buflen); +trace_nfs4_get_security_label (inode, err); + err =nfs4_handle_exception (NFS_SERVER (inode), err, &exception); }while (exception.retry);return err;
@@ -4520,9 +4527,10 @@ static int nfs4_do_set_security_label(struct inode *inode,int err;do { - err =nfs4_handle_exception (NFS_SERVER (inode), -_nfs4_do_set_security_label (inode, ilabel, - fattr, olabel), + err =_nfs4_do_set_security_label (inode, ilabel, + fattr, olabel); +trace_nfs4_set_security_label (inode, err); + err =nfs4_handle_exception (NFS_SERVER (inode), err, &exception); }while (exception.retry);return err;
fs/nfs/nfs4trace.h +46 -0
52 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 1/13 NFSv4: Add tracepoints for debugging state management problems
In reply to Trond MyklebustSet up basic tracepoints for debugging client id creation/destruction and session creation/destruction.
--- fs/nfs/Makefile | 3 +- fs/nfs/nfs4proc.c | 12 +++ fs/nfs/nfs4trace.c | 10 +++ fs/nfs/nfs4trace.h | 211 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 fs/nfs/nfs4trace.c create mode 100644 fs/nfs/nfs4trace.h
fs/nfs/Makefile +2 -1
@@ -21,7 +21,8 @@ nfsv3-$(CONFIG_NFS_V3_ACL) += nfs3acl.o obj-$(CONFIG_NFS_V4) += nfsv4.o nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \ delegation.o idmap.o callback.o callback_xdr.o callback_proc.o \ - nfs4namespace.o nfs4getroot.o nfs4client.o dns_resolve.o + nfs4namespace.o nfs4getroot.o nfs4client.o dns_resolve.o \ + nfs4trace.o nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o nfsv4-$(CONFIG_SYSCTL) += nfs4sysctl.o nfsv4-$(CONFIG_NFS_V4_1) += nfs4session.o pnfs.o pnfs_dev.o
fs/nfs/nfs4proc.c +12 -0
@@ -66,6 +66,8 @@#include "nfs4session.h" #include "fscache.h" +#include "nfs4trace.h" +#define NFSDBG_FACILITY NFSDBG_PROC#define NFS4_POLL_RETRY_MIN (HZ/10)
@@ -4064,6 +4066,7 @@ static void nfs4_renew_done(struct rpc_task *task, void *calldata)struct nfs_client *clp = data->client;unsigned long timestamp = data->timestamp; +trace_nfs4_renew_async (clp, task->tk_status);if (task->tk_status <0 ) {/* Unless we're shutting down, schedule state recovery! */ if (test_bit (NFS_CS_RENEWD , &clp->cl_res_state) ==0 )
@@ -4730,6 +4733,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, clp->cl_rpcclient->cl_auth->au_ops->au_name, setclientid.sc_name_len, setclientid.sc_name); status =rpc_call_sync (clp->cl_rpcclient, &msg,RPC_TASK_TIMEOUT ); +trace_nfs4_setclientid (clp, status);dprintk ("NFS reply setclientid: %d\n" , status);return status; }
@@ -4757,6 +4761,7 @@ int nfs4_proc_setclientid_confirm(struct nfs_client *clp, clp->cl_rpcclient->cl_auth->au_ops->au_name, clp->cl_clientid); status =rpc_call_sync (clp->cl_rpcclient, &msg,RPC_TASK_TIMEOUT ); +trace_nfs4_setclientid_confirm (clp, status);dprintk ("NFS reply setclientid_confirm: %d\n" , status);return status; }
@@ -5887,6 +5892,7 @@ int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred } status =rpc_call_sync (clp->cl_rpcclient, &msg,RPC_TASK_TIMEOUT ); +trace_nfs4_bind_conn_to_session (clp, status);if (status ==0 ) {if (memcmp (res.session->sess_id.data, clp->cl_session->sess_id.data,NFS4_MAX_SESSIONID_LEN )) {
@@ -5972,6 +5978,7 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) } status =rpc_call_sync (clp->cl_rpcclient, &msg,RPC_TASK_TIMEOUT ); +trace_nfs4_exchange_id (clp, status);if (status ==0 ) status =nfs4_check_cl_exchange_flags (res.flags);
@@ -6032,6 +6039,7 @@ static int _nfs4_proc_destroy_clientid(struct nfs_client *clp,int status; status =rpc_call_sync (clp->cl_rpcclient, &msg,RPC_TASK_TIMEOUT ); +trace_nfs4_destroy_clientid (clp, status);if (status)dprintk ("NFS: Got error %d from the server %s on " "DESTROY_CLIENTID." , status, clp->cl_hostname);
@@ -6295,6 +6303,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp, args.flags = (SESSION4_PERSIST |SESSION4_BACK_CHAN ); status =rpc_call_sync (session->clp->cl_rpcclient, &msg,RPC_TASK_TIMEOUT ); +trace_nfs4_create_session (clp, status);if (!status) {/* Verify the session's negotiated channel_attrs values */
@@ -6358,6 +6367,7 @@ int nfs4_proc_destroy_session(struct nfs4_session *session,return status; status =rpc_call_sync (session->clp->cl_rpcclient, &msg,RPC_TASK_TIMEOUT ); +trace_nfs4_destroy_session (session->clp, status);if (status) dprintk("NFS: Got error %d from the server on DESTROY_SESSION. "
@@ -6407,6 +6417,7 @@ static void nfs41_sequence_call_done(struct rpc_task *task, void *data)if (!nfs41_sequence_done (task, task->tk_msg.rpc_resp))return ; +trace_nfs4_sequence (clp, task->tk_status);if (task->tk_status <0 ) {dprintk ("%s ERROR %d\n" , __func__, task->tk_status);if (atomic_read (&clp->cl_count) ==1 )
@@ -6559,6 +6570,7 @@ static void nfs4_reclaim_complete_done(struct rpc_task *task, void *data)if (!nfs41_sequence_done (task, res))return ; +trace_nfs4_reclaim_complete (clp, task->tk_status);if (nfs41_reclaim_complete_handle_errors (task, clp) == -EAGAIN ) {rpc_restart_call_prepare (task);return ;
fs/nfs/nfs4trace.c new file +10 -0
@@ -0,0 +1,10 @@ +/* +* Copyright (c) 2013 Trond Myklebust <[email protected]> +*/ +#include <linux/nfs_fs.h> +#include "nfs4_fs.h" +#include "internal.h" + +#define CREATE_TRACE_POINTS +#include "nfs4trace.h" +
fs/nfs/nfs4trace.h new file +211 -0
211 lines not on this page · raw message
Signature · 1 line
1.8.3.1
v2 cover NFSv4 add debugging tracepoints
The following patchset sets up a number of ftrace tracepoints for use when debugging state operations.
Changes in v2:
- Fixed compile bugs
- We need to convert the delegation recall status to a negative number
- Added tracepoints for read/write, pnfs and slot table debugging.
Trond Myklebust (13):
NFSv4: Add tracepoints for debugging state management problems
NFS: refactor code for calculating the crc32 hash of a filehandle
NFSv4: Add tracepoints for debugging file open
NFSv4: Add tracepoints for debugging file locking
NFSv4: Add tracepoints for debugging lookup/create operations
NFSv4: Add tracepoints for debugging inode manipulations
NFSv4: Add tracepoints for debugging rename
NFSv4: Add tracepoints for debugging delegations
NFSv4: Add tracepoints for debugging the idmapper
NFSv4: Add tracepoints for debugging getattr
NFSv4: Add tracepoints for debugging reads and writes NFSv4.1: Add tracepoints for debugging layoutget/return/commit NFSv4.1: Add tracepoints for debugging slot table operations
fs/nfs/Makefile | 3 +- fs/nfs/callback_proc.c | 3 + fs/nfs/delegation.c | 3 + fs/nfs/idmap.c | 5 + fs/nfs/inode.c | 3 +- fs/nfs/internal.h | 20 + fs/nfs/nfs4filelayout.c | 10 + fs/nfs/nfs4proc.c | 135 +++++-- fs/nfs/nfs4session.h | 10 + fs/nfs/nfs4trace.c | 17 + fs/nfs/nfs4trace.h | 969 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.c | 7 + 12 files changed, 1146 insertions(+), 39 deletions(-) create mode 100644 fs/nfs/nfs4trace.c create mode 100644 fs/nfs/nfs4trace.h
Signature · 1 line
1.8.3.1