Re: [PATCH 4/5] kernfs: implement kernfs_path_len()
From: Tejun Heo
Date: Thu Jul 09 2015 - 17:41:57 EST
Hello, Nioklay.
I restored the cc list. Please use reply-to-all.
On Wed, Jul 08, 2015 at 11:08:43AM +0300, Nikolay Borisov wrote:
> > +size_t kernfs_path_len(struct kernfs_node *kn)
> > +{
> > + size_t len = 0;
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&kernfs_rename_lock, flags);
> > +
> > + do {
> > + len += strlen(kn->name) + 1;
> > + kn = kn->parent;
> > + } while (kn && kn->parent);
> > +
> > + spin_unlock_irqrestore(&kernfs_rename_lock, flags);
> > +
> > + return len;
> > +}
> > +
>
> Can you explain the reason why you need to disable the irqs while
> executing this function? Presumably it has to do with the context of its
> usage - tracepoints but I wasn't able to find any information about the
> implications of interrupts being enabled while in a trace point?
It doesn't have much to do with the specific usage.
kernfs_rename_lock is irq-safe because we want to be able to call
functions like kernfs_name() and kernfs_path() regardless of the
current context.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/