lkml.org 
[lkml]   [2013]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tracepoint] cargo-culting considered harmful...
On Wed, Jan 23, 2013 at 10:55:24PM +0000, Al Viro wrote:
> In samples/tracepoints/tracepoint-probe-sample.c:
> /*
> * Here the caller only guarantees locking for struct file and struct inode.
> * Locking must therefore be done in the probe to use the dentry.
> */
> static void probe_subsys_event(void *ignore,
> struct inode *inode, struct file *file)
> {
> path_get(&file->f_path);
> dget(file->f_path.dentry);
> printk(KERN_INFO "Event is encountered with filename %s\n",
> file->f_path.dentry->d_name.name);
> dput(file->f_path.dentry);
> path_put(&file->f_path);
> }
>
> note that
> * file->f_path is already pinned down by open(), path_get() does not
> provide anything extra.
> * file->f_path.dentry is already pinned by open() *and* path_get()
> just above that dget().
> * ->d_name.name *IS* *NOT* *PROTECTED* by pinning dentry down,
> whether it's done once or thrice.
>
> I do realize that it's just an example, but perhaps we should rename that
> file to match the contents? The only question is whether it should be
> git mv samples/tracepoints/{tracepoint-probe-sample,cargo-cult}.c
> or git mv samples cargo-cult...

I wonder if we should just remove the samples/tracepoints/ all together.
The tracepoint code is now only used internally by the trace_event code,
and there should not be any users of tracepoints directly.

-- Steve



\
 
 \ /
  Last update: 2013-01-24 00:41    [W:0.077 / U:2.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site