aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4layouts.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-08-16 20:02:22 -0400
committerChristoph Hellwig <hch@lst.de>2015-02-02 12:09:44 -0500
commit31ef83dc053835fc14741426e20c60dbbba8c13d (patch)
tree8c9a1cac8a5e29fa07b476d705d09ca0f79e40ee /fs/nfsd/nfs4layouts.c
parent18d1aef89ec14dd2c4afaa80b7b1b3497aa188c7 (diff)
nfsd: add trace events
For now just a few simple events to trace the layout stateid lifetime, but these already were enough to find several bugs in the Linux client layout stateid handling. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/nfsd/nfs4layouts.c')
-rw-r--r--fs/nfsd/nfs4layouts.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index d926865df94f..60137c54b2f7 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -9,6 +9,7 @@
9 9
10#include "pnfs.h" 10#include "pnfs.h"
11#include "netns.h" 11#include "netns.h"
12#include "trace.h"
12 13
13#define NFSDDBG_FACILITY NFSDDBG_PNFS 14#define NFSDDBG_FACILITY NFSDDBG_PNFS
14 15
@@ -125,6 +126,8 @@ nfsd4_free_layout_stateid(struct nfs4_stid *stid)
125 struct nfs4_client *clp = ls->ls_stid.sc_client; 126 struct nfs4_client *clp = ls->ls_stid.sc_client;
126 struct nfs4_file *fp = ls->ls_stid.sc_file; 127 struct nfs4_file *fp = ls->ls_stid.sc_file;
127 128
129 trace_layoutstate_free(&ls->ls_stid.sc_stateid);
130
128 spin_lock(&clp->cl_lock); 131 spin_lock(&clp->cl_lock);
129 list_del_init(&ls->ls_perclnt); 132 list_del_init(&ls->ls_perclnt);
130 spin_unlock(&clp->cl_lock); 133 spin_unlock(&clp->cl_lock);
@@ -215,6 +218,7 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate,
215 list_add(&ls->ls_perfile, &fp->fi_lo_states); 218 list_add(&ls->ls_perfile, &fp->fi_lo_states);
216 spin_unlock(&fp->fi_lock); 219 spin_unlock(&fp->fi_lock);
217 220
221 trace_layoutstate_alloc(&ls->ls_stid.sc_stateid);
218 return ls; 222 return ls;
219} 223}
220 224
@@ -280,6 +284,8 @@ nfsd4_recall_file_layout(struct nfs4_layout_stateid *ls)
280 if (list_empty(&ls->ls_layouts)) 284 if (list_empty(&ls->ls_layouts))
281 goto out_unlock; 285 goto out_unlock;
282 286
287 trace_layout_recall(&ls->ls_stid.sc_stateid);
288
283 atomic_inc(&ls->ls_stid.sc_count); 289 atomic_inc(&ls->ls_stid.sc_count);
284 update_stateid(&ls->ls_stid.sc_stateid); 290 update_stateid(&ls->ls_stid.sc_stateid);
285 memcpy(&ls->ls_recall_sid, &ls->ls_stid.sc_stateid, sizeof(stateid_t)); 291 memcpy(&ls->ls_recall_sid, &ls->ls_stid.sc_stateid, sizeof(stateid_t));
@@ -454,8 +460,10 @@ nfsd4_return_file_layouts(struct svc_rqst *rqstp,
454 nfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lrp->lr_sid, 460 nfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lrp->lr_sid,
455 false, lrp->lr_layout_type, 461 false, lrp->lr_layout_type,
456 &ls); 462 &ls);
457 if (nfserr) 463 if (nfserr) {
464 trace_layout_return_lookup_fail(&lrp->lr_sid);
458 return nfserr; 465 return nfserr;
466 }
459 467
460 spin_lock(&ls->ls_lock); 468 spin_lock(&ls->ls_lock);
461 list_for_each_entry_safe(lp, n, &ls->ls_layouts, lo_perstate) { 469 list_for_each_entry_safe(lp, n, &ls->ls_layouts, lo_perstate) {
@@ -472,6 +480,7 @@ nfsd4_return_file_layouts(struct svc_rqst *rqstp,
472 } 480 }
473 lrp->lrs_present = 1; 481 lrp->lrs_present = 1;
474 } else { 482 } else {
483 trace_layoutstate_unhash(&ls->ls_stid.sc_stateid);
475 nfs4_unhash_stid(&ls->ls_stid); 484 nfs4_unhash_stid(&ls->ls_stid);
476 lrp->lrs_present = 0; 485 lrp->lrs_present = 0;
477 } 486 }
@@ -570,6 +579,8 @@ nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls)
570 579
571 rpc_ntop((struct sockaddr *)&clp->cl_addr, addr_str, sizeof(addr_str)); 580 rpc_ntop((struct sockaddr *)&clp->cl_addr, addr_str, sizeof(addr_str));
572 581
582 nfsd4_cb_layout_fail(ls);
583
573 printk(KERN_WARNING 584 printk(KERN_WARNING
574 "nfsd: client %s failed to respond to layout recall. " 585 "nfsd: client %s failed to respond to layout recall. "
575 " Fencing..\n", addr_str); 586 " Fencing..\n", addr_str);
@@ -597,6 +608,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)
597 case 0: 608 case 0:
598 return 1; 609 return 1;
599 case -NFS4ERR_NOMATCHING_LAYOUT: 610 case -NFS4ERR_NOMATCHING_LAYOUT:
611 trace_layout_recall_done(&ls->ls_stid.sc_stateid);
600 task->tk_status = 0; 612 task->tk_status = 0;
601 return 1; 613 return 1;
602 case -NFS4ERR_DELAY: 614 case -NFS4ERR_DELAY:
@@ -624,6 +636,8 @@ nfsd4_cb_layout_release(struct nfsd4_callback *cb)
624 container_of(cb, struct nfs4_layout_stateid, ls_recall); 636 container_of(cb, struct nfs4_layout_stateid, ls_recall);
625 LIST_HEAD(reaplist); 637 LIST_HEAD(reaplist);
626 638
639 trace_layout_recall_release(&ls->ls_stid.sc_stateid);
640
627 nfsd4_return_all_layouts(ls, &reaplist); 641 nfsd4_return_all_layouts(ls, &reaplist);
628 nfsd4_free_layouts(&reaplist); 642 nfsd4_free_layouts(&reaplist);
629 nfs4_put_stid(&ls->ls_stid); 643 nfs4_put_stid(&ls->ls_stid);