lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 16 Feb 2018 18:10:13 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     John Ogness <john.ogness@...utronix.de>
Cc:     linux-fsdevel@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Christoph Hellwig <hch@....de>,
        Thomas Gleixner <tglx@...utronix.de>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] fs/dcache: Avoid the try_lock loop in d_delete()

On Fri, Feb 16, 2018 at 04:09:32PM +0100, John Ogness wrote:
> +static bool dentry_lock_inode(struct dentry *dentry)
> +{
> +	struct inode *inode = dentry->d_inode;
> +
> +	lockdep_assert_held(&dentry->d_lock);
> +
> +	if (unlikely(!spin_trylock(&inode->i_lock))) {

	if (likely(spin_trylock(&inode->i_lock)))
		return true;

and then unindent by 1 stop the below code:

> +		rcu_read_lock();
> +		spin_unlock(&dentry->d_lock);
> +		spin_lock(&inode->i_lock);
> +		spin_lock(&dentry->d_lock);
> +		rcu_read_unlock();
> +
> +		/*
> +		 * @dentry->d_inode might have changed after dropping
> +		 * @dentry->d_lock. If so, release @inode->i_lock and
> +		 * signal the caller to restart the operation.
> +		 */
> +		if (unlikely(inode != dentry->d_inode)) {
> +			spin_unlock(&inode->i_lock);
> +			return false;
> +		}
> +	}
> +	return true;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ