Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757077Ab3FMA7y (ORCPT ); Wed, 12 Jun 2013 20:59:54 -0400 Received: from mail-vb0-f47.google.com ([209.85.212.47]:58483 "EHLO mail-vb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755889Ab3FMA7x (ORCPT ); Wed, 12 Jun 2013 20:59:53 -0400 MIME-Version: 1.0 In-Reply-To: <20130613004941.GJ4165@ZenIV.linux.org.uk> References: <1370973186.1744.9.camel@buesod1.americas.hpqcorp.net> <1370974231.9844.212.camel@gandalf.local.home> <1371059401.1746.33.camel@buesod1.americas.hpqcorp.net> <1371067399.1746.47.camel@buesod1.americas.hpqcorp.net> <20130612233224.GH4165@ZenIV.linux.org.uk> <20130613002058.GI4165@ZenIV.linux.org.uk> <20130613004941.GJ4165@ZenIV.linux.org.uk> Date: Wed, 12 Jun 2013 17:59:52 -0700 X-Google-Sender-Auth: O4y90Z51uwtE9HjuIZdyn16eaXs Message-ID: Subject: Re: [PATCH RFC ticketlock] Auto-queued ticketlock From: Linus Torvalds To: Al Viro Cc: Davidlohr Bueso , Steven Rostedt , Paul McKenney , Linux Kernel Mailing List , Ingo Molnar , "?????????" , Dipankar Sarma , Andrew Morton , Mathieu Desnoyers , Josh Triplett , niv@us.ibm.com, Thomas Gleixner , Peter Zijlstra , Valdis Kletnieks , David Howells , Eric Dumazet , Darren Hart , "Fr??d??ric Weisbecker" , Silas Boyd-Wickizer , Waiman Long Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1547 Lines: 31 On Wed, Jun 12, 2013 at 5:49 PM, Al Viro wrote: > On Wed, Jun 12, 2013 at 05:38:13PM -0700, Linus Torvalds wrote: >> >> For the particular case of dget_parent() maybe dget_parent() should >> just double-check the original dentry->d_parent pointer after getting >> the refcount on it (and if the parent has changed, drop the refcount >> again and go to the locked version). That might be a good idea anyway, >> and should fix the possible race (which would be with another cpu >> having to first rename the child to some other parent, and the >> d_invalidate() the original parent) > > Yes, but... Then we'd need to dput() that sucker if we decide we shouldn't > have grabbed that reference, after all, which would make dget_parent() > potentially blocking. Ho humm.. interesting. I was talking about wanting to mix atomics and spinlocks earlier in this thread due to space constraints, and it strikes me that that would actually help this case a lot. Having the dentry count mix d_lock and the count in one word would allow for atomic ops like "increment if not locked", and we'd avoid this whole race entirely.. Something like "low bit of count is the lock bit" would end up being lovely for this case. Of course, that's not how our spinlocks work .. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/