Re: [PATCH] cowlinks v2

From: Andrew Morton
Date: Sat Mar 20 2004 - 03:54:29 EST


Jörn Engel <joern@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> +static long fcntl_setcow(struct file *filp, unsigned long arg)
> +{
> + struct inode *inode = filp->f_dentry->d_inode;
> +
> + spin_lock(&inode->i_lock);
> + if (arg)
> + inode->i_flags |= S_COWLINK;
> + else
> + inode->i_flags &= ~S_COWLINK;
> + mark_inode_dirty_sync(inode);
> + spin_unlock(&inode->i_lock);
> + return 0;
> +}
> +

i_lock is an innermost lock. No locks should be taken inside i_lock.

Here, not only is inode_lock being taken inside i_lock but ->dirty_inode
may be called as well, and dirty_inode() may not be called under any
spinlock.

-
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/