linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dcache locking question
@ 2019-03-14 22:56 Tobin C. Harding
  2019-03-14 23:09 ` Matthew Wilcox
  2019-03-14 23:19 ` Tobin C. Harding
  0 siblings, 2 replies; 17+ messages in thread
From: Tobin C. Harding @ 2019-03-14 22:56 UTC (permalink / raw)
  To: linux-fsdevel

Hi,

I'm not able to understand the locking order in dcache.  dcache has been
around for a while so clearly its right and I'm wrong.

Could someone please explain to me how the locking order commented at
the top of the file is not violated in the following:

From top of fs/dcache.c

 * If there is an ancestor relationship:
 * dentry->d_parent->...->d_parent->d_lock
 *   ...
 *     dentry->d_parent->d_lock
 *       dentry->d_lock


dentry_kill() appears to require caller to hold the dentry->d_lock yet
it locks the parent with spin_trylock(&parent->d_lock), if this
fails it calls __lock_parent() which releases the dentry->d_lock before
locking the parent and re-acquiring [1] the dentry->d_lock .  Is this not
locking in two different orders? 

The same logic exists in lock_parent().

thanks,
Tobin.


[1] I do not fully understand the spin_lock_nested() macro.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-03-19 15:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 22:56 dcache locking question Tobin C. Harding
2019-03-14 23:09 ` Matthew Wilcox
2019-03-15  1:38   ` Tobin C. Harding
2019-03-14 23:19 ` Tobin C. Harding
2019-03-15  1:50   ` Al Viro
2019-03-15 17:38     ` Eric Biggers
2019-03-15 18:54       ` Al Viro
2019-03-16 22:31         ` Paul E. McKenney
2019-03-17  0:18           ` Al Viro
2019-03-17  0:50             ` Paul E. McKenney
2019-03-17  2:20               ` James Bottomley
2019-03-17  3:06                 ` Al Viro
2019-03-17  4:23                   ` James Bottomley
2019-03-18  0:35                     ` Paul E. McKenney
2019-03-18 16:26                       ` James Bottomley
2019-03-18 17:11                         ` Paul E. McKenney
2019-03-19 15:45                           ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).