Access of global variables in the script

Frank Ch. Eigler fche@redhat.com
Fri Jun 23 17:43:00 GMT 2017


Hi -

> [...]
> I checked the function fullpath_struct_file in the dentry.stp. Can I
> code a better (faster) implementation than task_dentry_path() with
> inline C?
>
> A side note - task_dentry_path does not lock when traversing the
> dentry->parent... tree. Is it safe?

These two issues are related, and represent a deliberate design choice.
When one uses embedded-C code in stap, one has to shoulder the entire
burden of ensuring its safety & correctness.  A pointer use bug there
can bring the machine down.  Blocking for a lock can bring the machine
down.

In contrast, the same algorithm expressed within the script language
will use protected pointer dereferencing, time/space-limited
computation, and no blocking.  In the worst case, the script will stop,
or produce wrong results.  That is much better than the alternative.


> [...]
> semantic error: unable to find global 'rename_lock' in kernel, in
> fs/dcache.c: operator '@var' at <input>:1:36
> [...]

(Not sure about this part.)


- FChE



More information about the Systemtap mailing list