Re: [PATCH] fs/dcache: prevent repeated locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 07, 2021 at 01:17:41PM +0000, Matthew Wilcox wrote:
> On Tue, Dec 07, 2021 at 10:16:46AM +0000, cgel.zte@xxxxxxxxx wrote:
> > From: Lv Ruyi <lv.ruyi@xxxxxxxxxx>
> > 
> > Move the spin_lock above the restart to prevent to lock twice 
> > when the code goto restart.
> 
> This is madness.
> 
> void d_prune_aliases(struct inode *inode)
>         spin_lock(&inode->i_lock);
>                         if (likely(!dentry->d_lockref.count)) {
>                                 __dentry_kill(dentry);
>                                 goto restart;
> ...
> static void __dentry_kill(struct dentry *dentry)
>         if (dentry->d_inode)
>                 dentry_unlink_inode(dentry);
> ...
> static void dentry_unlink_inode(struct dentry * dentry)
>         spin_unlock(&inode->i_lock);
> 
> Did you even test this patch?

This same wrong patch has been sent several times before.  I think it's fair to
say that this code could use a comment, e.g.:

	/* i_lock was dropped */
	goto restart;

- Eric



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux