[PATCH v2 27/27] NFSD: Replace dprintk callsites in fs/nfsd/nfsfh.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Report the input and result of fh_verify. The other dprintk
callsites are rather stale and so are removed.

nfsd-1025  [002]   256.807404: nfsd_fh_verify:       xid=0x12147d7a fh_hash=0x6085d6fb type=NONE access=WRITE|SATTR|OWNER_OVERRIDE status=0

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---
 fs/nfsd/nfsfh.c |   36 ++----------------------------------
 fs/nfsd/trace.h |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index c81dbbad8792..dd2d26ddf3f4 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -16,9 +16,6 @@
 #include "auth.h"
 #include "trace.h"
 
-#define NFSDDBG_FACILITY		NFSDDBG_FH
-
-
 /*
  * our acceptability function.
  * if NOSUBTREECHECK, accept anything
@@ -48,8 +45,6 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
 		dput(tdentry);
 		tdentry = parent;
 	}
-	if (tdentry != exp->ex_path.dentry)
-		dprintk("nfsd_acceptable failed at %p %pd\n", tdentry, tdentry);
 	rv = (tdentry == exp->ex_path.dentry);
 	dput(tdentry);
 	return rv;
@@ -104,12 +99,8 @@ static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
 	int flags = nfsexp_flags(rqstp, exp);
 
 	/* Check if the request originated from a secure port. */
-	if (!nfsd_originating_port_ok(rqstp, flags)) {
-		RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
-		dprintk("nfsd: request from insecure port %s!\n",
-		        svc_print_addr(rqstp, buf, sizeof(buf)));
+	if (!nfsd_originating_port_ok(rqstp, flags))
 		return nfserr_perm;
-	}
 
 	/* Set user creds for this exportpoint */
 	return nfserrno(nfsd_setuser(rqstp, exp));
@@ -331,8 +322,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
 	struct dentry	*dentry;
 	__be32		error;
 
-	dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp));
-
 	if (!fhp->fh_dentry) {
 		error = nfsd_set_fh_dentry(rqstp, fhp);
 		if (error)
@@ -391,16 +380,10 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
 skip_pseudoflavor_check:
 	/* Finally, check access permissions. */
 	error = nfsd_permission(rqstp, exp, dentry, access);
-
-	if (error) {
-		dprintk("fh_verify: %pd2 permission failure, "
-			"acc=%x, error=%d\n",
-			dentry,
-			access, ntohl(error));
-	}
 out:
 	if (error == nfserr_stale)
 		nfsdstats.fh_stale++;
+	trace_nfsd_fh_verify(rqstp, fhp, type, access, error);
 	return error;
 }
 
@@ -547,12 +530,6 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
 	struct inode * inode = d_inode(dentry);
 	dev_t ex_dev = exp_sb(exp)->s_dev;
 
-	dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n",
-		MAJOR(ex_dev), MINOR(ex_dev),
-		(long) d_inode(exp->ex_path.dentry)->i_ino,
-		dentry,
-		(inode ? inode->i_ino : 0));
-
 	/* Choose filehandle version and fsid type based on
 	 * the reference filehandle (if it is in the same export)
 	 * or the export options.
@@ -562,15 +539,6 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
 	if (ref_fh == fhp)
 		fh_put(ref_fh);
 
-	if (fhp->fh_locked || fhp->fh_dentry) {
-		printk(KERN_ERR "fh_compose: fh %pd2 not initialized!\n",
-		       dentry);
-	}
-	if (fhp->fh_maxsize < NFS_FHSIZE)
-		printk(KERN_ERR "fh_compose: called with maxsize %d! %pd2\n",
-		       fhp->fh_maxsize,
-		       dentry);
-
 	fhp->fh_dentry = dget(dentry); /* our internal copy */
 	fhp->fh_export = exp_get(exp);
 
diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 50ab4a84c25f..47d0fea70f34 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -181,6 +181,48 @@ TRACE_EVENT(nfsd_setattr_args,
 	)
 );
 
+TRACE_EVENT(nfsd_fh_verify,
+	TP_PROTO(
+		const struct svc_rqst *rqstp,
+		const struct svc_fh *fhp,
+		umode_t type,
+		int access,
+		__be32 status
+	),
+	TP_ARGS(rqstp, fhp, type, access, status),
+	TP_STRUCT__entry(
+		__field(u32, xid)
+		__field(u32, fh_hash)
+		__field(unsigned long, type)
+		__field(unsigned long, access)
+		__field(unsigned long, status)
+		__dynamic_array(unsigned char, name,
+				fhp->fh_dentry->d_name.len + 1)
+	),
+	TP_fast_assign(
+		const struct dentry *dentry = fhp->fh_dentry;
+
+		__entry->xid = be32_to_cpu(rqstp->rq_xid);
+		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
+		__entry->type = type & S_IFMT;
+		__entry->access = access;
+		__entry->status = be32_to_cpu(status);
+		if (dentry) {
+			memcpy(__get_str(name), dentry->d_name.name,
+			       dentry->d_name.len);
+			__get_str(name)[dentry->d_name.len] = '\0';
+		} else {
+			__get_str(name)[0] = '\0';
+		}
+	),
+	TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s name=%s status=%s",
+		__entry->xid, __entry->fh_hash,
+		show_inode_type(__entry->type),
+		show_nfsd_may_flags(__entry->access),
+		__get_str(name), show_nfs4_status(__entry->status)
+	)
+);
+
 DECLARE_EVENT_CLASS(nfsd_fh_err_class,
 	TP_PROTO(struct svc_rqst *rqstp,
 		 struct svc_fh	*fhp,





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux