From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:37344 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754867AbcGEMbN (ORCPT ); Tue, 5 Jul 2016 08:31:13 -0400 Date: Tue, 5 Jul 2016 13:31:10 +0100 From: Al Viro To: Oleg Drokin Cc: Mailing List , "" Subject: Re: More parallel atomic_open/d_splice_alias fun with NFS and possibly more FSes. Message-ID: <20160705123110.GL14480@ZenIV.linux.org.uk> References: <20160617042914.GD14480@ZenIV.linux.org.uk> <20160703062917.GG14480@ZenIV.linux.org.uk> <94F1587A-7AFC-4B48-A0FC-F4CE152F18CC@linuxhacker.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94F1587A-7AFC-4B48-A0FC-F4CE152F18CC@linuxhacker.ru> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Jul 05, 2016 at 02:22:48AM -0400, Oleg Drokin wrote: > > + if (!(open_flags & O_CREAT) && !d_unhashed(dentry)) { s/d_unhashed/d_in_lookup/ in that. > So we come racing here from multiple threads (say 3 or more - we have seen this > in the older crash reports, so totally possible) > > > + d_drop(dentry); > > One lucky one does this first before the others perform the !d_unhashed check above. > This makes the other ones to not enter here. > > And we are back to the original problem of multiple threads trying to instantiate > same dentry as before. Yep. See above - it should've been using d_in_lookup() in the first place, through the entire nfs_atomic_open(). Same in the Lustre part of fixes, obviously.