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 12:49 PM, sbocahu@bearstech.com wrote:
>>> When(/if) I figure out how to get the filename, I'll let you know.  If
>>> you figure it out, let me know.
>>
>> Here's that previous script updated to probe nfsd_vfs_write().  Let me
>> know if this doesn't work for you.
> 
> ...script deleted...
> 
> It works ! I only changed 
> 
>  		printf("nfsd_vfs_write: file = %p (%s)\n", $file,
>  			d_name($file->f_dentry))
> 
> to
> 
>  		printf("nfsd_vfs_write: file = %p (%s)\n", $file,
>  			d_name($file->f_path->dentry))
> 
> 
> Although my kernel's fs.h has 

When I started playing around with this I figured you were on an older
kernel since you were using NFSv3 - but I was wrong.  Here's that
portion of the script modified to handle older or newer kernels.  It
also prints the export name.

====
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(@defined($file->f_path->dentry)
			      ? $file->f_path->dentry
			      : $file->f_dentry))
	else
		printf("nfsd_vfs_write: file = %p (NULL)\n", $file)
	if ($fhp->fh_export)
		printf("export: %s\n",
		       @defined($fhp->fh_export->ex_pathname)
				? kernel_string($fhp->fh_export->ex_pathname)
				: kernel_string($fhp->fh_export->ex_path))
}
====

-- 
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]