This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: NFSD tapset: how can I get filename from filehandles ?


On 08/24/2010 11:13 AM, David Smith wrote:
> When(/if) I figure out how to get the filename, I'll let you know.  If
> you figure it out, let me know.

OK, here's what I found after some more experimentation.  Kernel
function  nfsd3_proc_write() (which is what 'nfsd.proc3.write' probes)
sets up a few things, then calls nfsd_write() (which is what
'nfsd.write' probes).  nfsd_write() makes sure the file pointer is set
up and then calls nfsd_vfs_write().  So, that's the first place the file
pointer is valid.

Here's that previous script updated to probe nfsd_vfs_write().  Let me
know if this doesn't work for you.

====
probe nfsd.proc3.write
{
	printf("fh = %p\n", fh)
	dentry = @cast(fh, "svc_fh", "kernel:nfsd")->fh_dentry
	printf("dentry = %p\n", dentry)
	if (dentry)
		printf("writing file %s\n", d_name(dentry))
	else
		printf("no dentry!\n")
}

probe nfsd.write
{
	printf("nfsd.write: fh = %s, file = %p\n", fh, file)
	dentry = @cast($fhp, "svc_fh", "kernel:nfsd")->fh_dentry
	printf("nfsd.write: dentry = %p\n", dentry)
}

probe kernel.function("nfsd_vfs_write") !,
      module("nfsd").function("nfsd_vfs_write")
{
	if ($file)
		printf("nfsd_vfs_write: file = %p (%s)\n", $file,
			d_name($file->f_dentry))
	else
		printf("nfsd_vfs_write: file = %p (NULL)\n", $file)
}
====


-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]