This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: NFSD tapset: how can I get filename from filehandles ?
>> 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.
aaaaaah 8) ! It explains my read faults, I was looking at the wrong
place...
> 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
#define f_dentry f_path.dentry
in the 'struct file' definition, systemtap shows this error when accessing
its f_dentry member:
semantic error: unable to find member 'f_dentry' for struct file
(alternatives: f_u f_path f_op f_lock f_count f_flags f_mode f_pos f_owner
f_cred f_ra f_version f_security private_data f_ep_links f_mapping):
operator '->' at ./nfsd-filestats.stp:53:16
source: d_name($file->f_dentry)
I guess I'm now able to achieve my script :)
Thank you very much for your very good and quick help !
Cheers,
Sebastien