On Sun, 04 Mar 2007 13:26:49 -0500,
Mark Lord <[EMAIL PROTECTED]> wrote:

> The simplest fix for this bug is to prevent sysfs_move_dir()
> from self-deadlocking when (old_parent == new_parent).
> 
> This patch prevents total system lockup when using rfcomm devices.
> 
> Signed-off-by:  Mark Lord <[EMAIL PROTECTED]>
> ---
> --- 2.6.21/fs/sysfs/dir.c     2007-03-04 13:19:00.000000000 -0500
> +++ linux/fs/sysfs/dir.c      2007-03-04 13:20:45.000000000 -0500
> @@ -431,6 +431,8 @@
>       new_parent_dentry = new_parent ?
>               new_parent->dentry : sysfs_mount->mnt_sb->s_root;
> 
> +     if (old_parent_dentry->d_inode == new_parent_dentry->d_inode)
> +             return 0;       /* nothing to move */
>  again:
>       mutex_lock(&old_parent_dentry->d_inode->i_mutex);
>       if (!mutex_trylock(&new_parent_dentry->d_inode->i_mutex)) {

Hm, never thought that someone might call the moving functions with
old_parent == new_parent, sorry about that. It should be safe to
return success here, we add only a bit of overhead with some driver
model juggling and emitting a not needed uevent.

Acked-by: Cornelia Huck <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to