diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-12 16:45:55 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-22 08:58:22 -0400 |
commit | 078ea3dfe396b18ccf608c71a9585b6f7e519bb1 (patch) | |
tree | 81f454091ab2e1847791de35f6fa8447e7e8c982 | |
parent | d1b748a5e71106481015e36ce327747b075bcbdc (diff) |
NFSv4: Add tracepoints for debugging lookup/create operations
Set up basic tracepoints for debugging NFSv4 lookup, unlink/remove,
symlink, mkdir, mknod, fs_locations and secinfo.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 36 | ||||
-rw-r--r-- | fs/nfs/nfs4trace.h | 50 |
2 files changed, 72 insertions, 14 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6d12c3eda17a..323475856d88 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3026,6 +3026,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, | |||
3026 | int err; | 3026 | int err; |
3027 | do { | 3027 | do { |
3028 | err = _nfs4_proc_lookup(client, dir, name, fhandle, fattr, label); | 3028 | err = _nfs4_proc_lookup(client, dir, name, fhandle, fattr, label); |
3029 | trace_nfs4_lookup(dir, name, err); | ||
3029 | switch (err) { | 3030 | switch (err) { |
3030 | case -NFS4ERR_BADNAME: | 3031 | case -NFS4ERR_BADNAME: |
3031 | err = -ENOENT; | 3032 | err = -ENOENT; |
@@ -3261,8 +3262,9 @@ static int nfs4_proc_remove(struct inode *dir, struct qstr *name) | |||
3261 | struct nfs4_exception exception = { }; | 3262 | struct nfs4_exception exception = { }; |
3262 | int err; | 3263 | int err; |
3263 | do { | 3264 | do { |
3264 | err = nfs4_handle_exception(NFS_SERVER(dir), | 3265 | err = _nfs4_proc_remove(dir, name); |
3265 | _nfs4_proc_remove(dir, name), | 3266 | trace_nfs4_remove(dir, name, err); |
3267 | err = nfs4_handle_exception(NFS_SERVER(dir), err, | ||
3266 | &exception); | 3268 | &exception); |
3267 | } while (exception.retry); | 3269 | } while (exception.retry); |
3268 | return err; | 3270 | return err; |
@@ -3291,7 +3293,8 @@ static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlin | |||
3291 | 3293 | ||
3292 | static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) | 3294 | static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) |
3293 | { | 3295 | { |
3294 | struct nfs_removeres *res = task->tk_msg.rpc_resp; | 3296 | struct nfs_unlinkdata *data = task->tk_calldata; |
3297 | struct nfs_removeres *res = &data->res; | ||
3295 | 3298 | ||
3296 | if (!nfs4_sequence_done(task, &res->seq_res)) | 3299 | if (!nfs4_sequence_done(task, &res->seq_res)) |
3297 | return 0; | 3300 | return 0; |
@@ -3533,9 +3536,9 @@ static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, | |||
3533 | label = nfs4_label_init_security(dir, dentry, sattr, &l); | 3536 | label = nfs4_label_init_security(dir, dentry, sattr, &l); |
3534 | 3537 | ||
3535 | do { | 3538 | do { |
3536 | err = nfs4_handle_exception(NFS_SERVER(dir), | 3539 | err = _nfs4_proc_symlink(dir, dentry, page, len, sattr, label); |
3537 | _nfs4_proc_symlink(dir, dentry, page, | 3540 | trace_nfs4_symlink(dir, &dentry->d_name, err); |
3538 | len, sattr, label), | 3541 | err = nfs4_handle_exception(NFS_SERVER(dir), err, |
3539 | &exception); | 3542 | &exception); |
3540 | } while (exception.retry); | 3543 | } while (exception.retry); |
3541 | 3544 | ||
@@ -3572,8 +3575,9 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, | |||
3572 | 3575 | ||
3573 | sattr->ia_mode &= ~current_umask(); | 3576 | sattr->ia_mode &= ~current_umask(); |
3574 | do { | 3577 | do { |
3575 | err = nfs4_handle_exception(NFS_SERVER(dir), | 3578 | err = _nfs4_proc_mkdir(dir, dentry, sattr, label); |
3576 | _nfs4_proc_mkdir(dir, dentry, sattr, label), | 3579 | trace_nfs4_mkdir(dir, &dentry->d_name, err); |
3580 | err = nfs4_handle_exception(NFS_SERVER(dir), err, | ||
3577 | &exception); | 3581 | &exception); |
3578 | } while (exception.retry); | 3582 | } while (exception.retry); |
3579 | nfs4_label_release_security(label); | 3583 | nfs4_label_release_security(label); |
@@ -3680,8 +3684,9 @@ static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, | |||
3680 | 3684 | ||
3681 | sattr->ia_mode &= ~current_umask(); | 3685 | sattr->ia_mode &= ~current_umask(); |
3682 | do { | 3686 | do { |
3683 | err = nfs4_handle_exception(NFS_SERVER(dir), | 3687 | err = _nfs4_proc_mknod(dir, dentry, sattr, label, rdev); |
3684 | _nfs4_proc_mknod(dir, dentry, sattr, label, rdev), | 3688 | trace_nfs4_mknod(dir, &dentry->d_name, err); |
3689 | err = nfs4_handle_exception(NFS_SERVER(dir), err, | ||
3685 | &exception); | 3690 | &exception); |
3686 | } while (exception.retry); | 3691 | } while (exception.retry); |
3687 | 3692 | ||
@@ -5801,8 +5806,10 @@ int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir, | |||
5801 | struct nfs4_exception exception = { }; | 5806 | struct nfs4_exception exception = { }; |
5802 | int err; | 5807 | int err; |
5803 | do { | 5808 | do { |
5804 | err = nfs4_handle_exception(NFS_SERVER(dir), | 5809 | err = _nfs4_proc_fs_locations(client, dir, name, |
5805 | _nfs4_proc_fs_locations(client, dir, name, fs_locations, page), | 5810 | fs_locations, page); |
5811 | trace_nfs4_get_fs_locations(dir, name, err); | ||
5812 | err = nfs4_handle_exception(NFS_SERVER(dir), err, | ||
5806 | &exception); | 5813 | &exception); |
5807 | } while (exception.retry); | 5814 | } while (exception.retry); |
5808 | return err; | 5815 | return err; |
@@ -5841,8 +5848,9 @@ int nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, | |||
5841 | struct nfs4_exception exception = { }; | 5848 | struct nfs4_exception exception = { }; |
5842 | int err; | 5849 | int err; |
5843 | do { | 5850 | do { |
5844 | err = nfs4_handle_exception(NFS_SERVER(dir), | 5851 | err = _nfs4_proc_secinfo(dir, name, flavors); |
5845 | _nfs4_proc_secinfo(dir, name, flavors), | 5852 | trace_nfs4_secinfo(dir, name, err); |
5853 | err = nfs4_handle_exception(NFS_SERVER(dir), err, | ||
5846 | &exception); | 5854 | &exception); |
5847 | } while (exception.retry); | 5855 | } while (exception.retry); |
5848 | return err; | 5856 | return err; |
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index 3f124dbcd60a..2646a50a8208 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h | |||
@@ -411,6 +411,56 @@ DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim); | |||
411 | DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired); | 411 | DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired); |
412 | DEFINE_NFS4_LOCK_EVENT(nfs4_unlock); | 412 | DEFINE_NFS4_LOCK_EVENT(nfs4_unlock); |
413 | 413 | ||
414 | DECLARE_EVENT_CLASS(nfs4_lookup_event, | ||
415 | TP_PROTO( | ||
416 | const struct inode *dir, | ||
417 | const struct qstr *name, | ||
418 | int error | ||
419 | ), | ||
420 | |||
421 | TP_ARGS(dir, name, error), | ||
422 | |||
423 | TP_STRUCT__entry( | ||
424 | __field(dev_t, dev) | ||
425 | __field(int, error) | ||
426 | __field(u64, dir) | ||
427 | __string(name, name->name) | ||
428 | ), | ||
429 | |||
430 | TP_fast_assign( | ||
431 | __entry->dev = dir->i_sb->s_dev; | ||
432 | __entry->dir = NFS_FILEID(dir); | ||
433 | __entry->error = error; | ||
434 | __assign_str(name, name->name); | ||
435 | ), | ||
436 | |||
437 | TP_printk( | ||
438 | "error=%d (%s) name=%02x:%02x:%llu/%s", | ||
439 | __entry->error, | ||
440 | show_nfsv4_errors(__entry->error), | ||
441 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
442 | (unsigned long long)__entry->dir, | ||
443 | __get_str(name) | ||
444 | ) | ||
445 | ); | ||
446 | |||
447 | #define DEFINE_NFS4_LOOKUP_EVENT(name) \ | ||
448 | DEFINE_EVENT(nfs4_lookup_event, name, \ | ||
449 | TP_PROTO( \ | ||
450 | const struct inode *dir, \ | ||
451 | const struct qstr *name, \ | ||
452 | int error \ | ||
453 | ), \ | ||
454 | TP_ARGS(dir, name, error)) | ||
455 | |||
456 | DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup); | ||
457 | DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink); | ||
458 | DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir); | ||
459 | DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod); | ||
460 | DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove); | ||
461 | DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations); | ||
462 | DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo); | ||
463 | |||
414 | #endif /* _TRACE_NFS4_H */ | 464 | #endif /* _TRACE_NFS4_H */ |
415 | 465 | ||
416 | #undef TRACE_INCLUDE_PATH | 466 | #undef TRACE_INCLUDE_PATH |