Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx> --- fs/nfsd/nfs3proc.c | 3 +++ fs/nfsd/trace.h | 25 +++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 3 files changed, 30 insertions(+) diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index 372bdcf5e07a5c835da240ecebb02e3576eb2ca6..5d2b081072e8c2e286c6815c34e5e58d4be15067 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -14,6 +14,7 @@ #include "xdr3.h" #include "vfs.h" #include "filecache.h" +#include "trace.h" #define NFSDDBG_FACILITY NFSDDBG_PROC @@ -266,6 +267,8 @@ nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, __be32 status; int host_err; + trace_nfsd_vfs_create(rqstp, fhp, S_IFREG, argp->name, argp->len); + if (isdotent(argp->name, argp->len)) return nfserr_exist; if (!(iap->ia_valid & ATTR_MODE)) diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index 382849d7c321d6ded8213890c2e7075770aa716c..752d81629e04f805536295f00a16721f57272fbe 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -2391,6 +2391,31 @@ TRACE_EVENT(nfsd_lookup_dentry, TP_printk("xid=0x%08x fh_hash=0x%08x name=%s", __entry->xid, __entry->fh_hash, __get_str(name)) ); + +TRACE_EVENT(nfsd_vfs_create, + TP_PROTO(struct svc_rqst *rqstp, + struct svc_fh *fhp, + umode_t type, + const char *name, + unsigned int len), + TP_ARGS(rqstp, fhp, type, name, len), + TP_STRUCT__entry( + SVC_RQST_ENDPOINT_FIELDS(rqstp) + __field(u32, fh_hash) + __field(umode_t, type) + __string_len(name, name, len) + ), + TP_fast_assign( + SVC_RQST_ENDPOINT_ASSIGNMENTS(rqstp); + __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); + __entry->type = type; + __assign_str(name); + ), + TP_printk("xid=0x%08x fh_hash=0x%08x type=%s name=%s", + __entry->xid, __entry->fh_hash, + show_fs_file_type(__entry->type), __get_str(name)) +); + #endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 276fbb572ead90fd07cde6922a697e07148926de..888572727d332dafd3e520f4801c4b0ca4e5c96c 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1574,6 +1574,8 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, __be32 err; int host_err; + trace_nfsd_vfs_create(rqstp, fhp, type, fname, flen); + if (isdotent(fname, flen)) return nfserr_exist; -- 2.49.0