public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: David Smith <dsmith@redhat.com>
To: hai wu <haiwu.us@gmail.com>, systemtap@sourceware.org
Subject: Re: [PATCH] filename in tapset nfs.proc.open and nfs.proc.release
Date: Mon, 15 Dec 2014 20:07:00 -0000	[thread overview]
Message-ID: <548F3F8D.8000900@redhat.com> (raw)
In-Reply-To: <CAJ1=nZcYtxopEs-XGj-Cs89dfzA2LF8oScnc_b+JE1zysg1T=Q@mail.gmail.com>

On 12/13/2014 10:35 PM, hai wu wrote:
> tapset nfs.proc.open and nfs.proc.release in nfs_proc.stp only records
> file's basename, which is not helpful when we use it to monitor NFS
> file access activities.
> 
> The following patch would allow us to be able to see the full path for
> NFS file, along with its NFS mount information.
> 
> diff --git a/tapset/linux/nfs_proc.stp b/tapset/linux/nfs_proc.stp
> index 1339aee..5a804e4 100644
> --- a/tapset/linux/nfs_proc.stp
> +++ b/tapset/linux/nfs_proc.stp
> @@ -1658,7 +1658,7 @@ probe nfs.proc.open = kernel.function("nfs_open") !,
>         prot = get_prot_from_client(client)
>         version = __nfs_version($inode)
> 
> -       filename = __file_filename($filp)
> +  filename = task_dentry_path(task_current(), $filp->f_dentry, $filp->f_vfsmnt)

Thanks for the patch, but I don't think this is really what we want
here. Here's why:

- The __file_filename() function just does a few casts and copies a
field out of $filp. It is fairly low cost.

- The task_dentry_path() function has to recursively walk the filesystem
building the full path. It can be quite expensive, depending on how deep
the file is in the nfs mount or how far down the the nfs mount is
mounted on the client system.

In general, we try to keep those convenience variables low cost. If your
use case needs a full path, that's fine. We just shouldn't make everyone
pay the higher cost.


Your 2nd email noted that you needed a different line for RHEL6:

filename = task_dentry_path(task_current(), $filp->f_path->dentry,
$filp->f_path->mnt)

Here's a (untested) way to use the same source line everywhere:

  pathname = task_dentry_path(task_current(),
	@choose_defined($filp->f_dentry, $filp->f_path->dentry),
	@choose_defined($filp->f_vfsmnt, $filp->f_path->mnt))

I hope this helps.

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

  parent reply	other threads:[~2014-12-15 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-14  4:35 hai wu
2014-12-15 19:11 ` hai wu
2014-12-15 20:07 ` David Smith [this message]
2014-12-15 20:34   ` Frank Ch. Eigler
2014-12-17 15:11     ` David Smith
2014-12-17 17:36       ` Lukas Berk
2014-12-17 19:46         ` David Smith
2014-12-18  0:07           ` Lukas Berk
2014-12-18  2:06             ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=548F3F8D.8000900@redhat.com \
    --to=dsmith@redhat.com \
    --cc=haiwu.us@gmail.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).