Re: processes hung after sys_renameat, and 'missing' processes

From: Al Viro
Date: Wed Jun 06 2012 - 20:40:01 EST


On Wed, Jun 06, 2012 at 08:29:14PM -0400, Dave Jones wrote:
> void d_move(struct dentry *dentry, struct dentry *target)
> {
> write_seqlock(&rename_lock);
> +
> + BUG_ON(!spin_is_locked(&target->d_parent->d_lock));
> +
> + if (dentry->d_parent != NULL)
> + BUG_ON(!spin_is_locked(&dentry->d_parent->d_lock));
> +
> __d_move(dentry, target);
> write_sequnlock(&rename_lock);
> }
>
>
> To be clear, do you want me to try that with or without the reverts ?

No. Not ->d_lock; ->d_inode->i_mutex. _That_ needs to be held for
d_move() to be safe (and on cross-directory move you need ->s_vfs_rename_mutex
as well). I'd do it with WARN_ON, BTW, and without the reverts - that
way we'll have a clear indication if that code is stepped on.
--
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/