Re: [PATCH][RFC] %pd - for printing dentry name

From: Al Viro
Date: Wed Feb 03 2010 - 23:54:16 EST


On Wed, Feb 03, 2010 at 03:04:19AM +0000, Al Viro wrote:
> On Tue, Feb 02, 2010 at 11:19:52AM -0800, Eric W. Biederman wrote:
>
> > If we are going to take a lock this seems as sane as any.
> >
> > Do we want to honor oops_in_progress aka bust_spinlocks here?
> >
> > Perhaps just:
> > if (oops_in_progress)
> > return buf;
> >
> > To guarantee we get the rest of a panic message out of the kernel.
>
> Hmm... There's another fun issue - we would want local_irq_disable() /
> local_irq_enable() in d_move_locked and local_irq_save/local_irq_restore()
> in dname_string(), AFAICT.
>
> OK, here's what I've got from moving in that direction. Folks, how does
> that one look to you? I'm not too happy about explicit manipulations
> with irq flags in there, so any suggestions would be welcome.

Argh. No, it's not at all better. Moreover, even read_seqbegin variant
is b0rken if we ever do that under ->d_lock.

CPU1:A: grabs dentry->d_lock
CPU2:B: calls d_move_locked()
CPU2:B: grabs rename_lock
CPU2:B: spins on dentry->d_lock
CPU1:A: calls printk with %pd dentry
CPU1:A: spins waiting for rename_lock writer to release it

So much for that approach ;-/
--
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/