Re: [PATCH v2 5/6] fs/dcache: Avoid a try_lock loop in shrink_dentry_list()

2018-02-22 Thread Al Viro
On Fri, Feb 23, 2018 at 12:50:24AM +0100, John Ogness wrote: > - while (dentry && !lockref_put_or_lock(>d_lockref)) { > - parent = lock_parent(dentry); > - if (dentry->d_lockref.count != 1) { > -

Re: [PATCH v2 5/6] fs/dcache: Avoid a try_lock loop in shrink_dentry_list()

2018-02-22 Thread Al Viro
On Fri, Feb 23, 2018 at 12:50:24AM +0100, John Ogness wrote: > - while (dentry && !lockref_put_or_lock(>d_lockref)) { > - parent = lock_parent(dentry); > - if (dentry->d_lockref.count != 1) { > -

[PATCH v2 5/6] fs/dcache: Avoid a try_lock loop in shrink_dentry_list()

2018-02-22 Thread John Ogness
shrink_dentry_list() holds dentry->d_lock and needs to acquire dentry->d_inode->i_lock. This cannot be done with a spin_lock() operation because it's the reverse of the regular lock order. To avoid ABBA deadlocks it is done with a trylock loop. Trylock loops are problematic in two scenarios:

[PATCH v2 5/6] fs/dcache: Avoid a try_lock loop in shrink_dentry_list()

2018-02-22 Thread John Ogness
shrink_dentry_list() holds dentry->d_lock and needs to acquire dentry->d_inode->i_lock. This cannot be done with a spin_lock() operation because it's the reverse of the regular lock order. To avoid ABBA deadlocks it is done with a trylock loop. Trylock loops are problematic in two scenarios: