Re: [PATCH] cowlinks v2

Andrew Morton
2004-03-20T08:49:05Z

Jörn Engel <joern@wohnheim.fh-wedel.de> 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.