From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932149Ab1DLQC6 (ORCPT ); Tue, 12 Apr 2011 12:02:58 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49679 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758065Ab1DLQC4 (ORCPT ); Tue, 12 Apr 2011 12:02:56 -0400 Date: Tue, 12 Apr 2011 09:02:20 -0700 From: Greg KH To: Sebastian Ott Cc: linux-kernel@vger.kernel.org Subject: Re: sysfs: cannot create duplicate filename Message-ID: <20110412160220.GA28483@suse.de> References: <20110411141309.GA8924@suse.de> <20110411144956.GA16610@suse.de> <20110411151947.GA17913@suse.de> <20110411175628.GA24301@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 12, 2011 at 04:39:49PM +0200, Sebastian Ott wrote: > > > On Mon, 11 Apr 2011, Greg KH wrote: > > > On Mon, Apr 11, 2011 at 07:50:34PM +0200, Sebastian Ott wrote: > > > > > > > > > On Mon, 11 Apr 2011, Greg KH wrote: > > > > > > > On Mon, Apr 11, 2011 at 05:05:08PM +0200, Sebastian Ott wrote: > > > > > > > > > > > > > > > On Mon, 11 Apr 2011, Greg KH wrote: > > > > > > > > > > > On Mon, Apr 11, 2011 at 04:33:03PM +0200, Sebastian Ott wrote: > > > > > > > On Mon, 11 Apr 2011, Greg KH wrote: > > > > > > > > > > > > > > > On Mon, Apr 11, 2011 at 04:04:08PM +0200, Sebastian Ott wrote: > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > > i've seen this warning which looks to be caused by a race between device_add > > > > > > > > > and driver_register > > > > > > > > > > > > > > > > > > [ 80.893594] sysfs: cannot create duplicate filename '/bus/ccw/drivers/qeth/0.0.b57d' > > > > > > > > > > > > > > > > Isn't the problem here the fact that you are creating 2 directories of > > > > > > > > the same name? > > > > > > > I'm sure this isn't the case here. The bus code just calls device_add and > > > > > > > at the same time on a different thread a module is loaded which registers > > > > > > > a driver at the bus. > > > > > > > > > > > > > > I was able to reproduce this with a module which creates a dummy bus > > > > > > > and registers drivers and devices on this bus on 2 different workqueues. > > > > > > > > > > > > That makes sense, as no bus should be doing this on multiple "threads". > > > > > > What real-life bus does this today? > > > > > A bus that will recognize and register a lot of devices, after the first > > > > > uevent is presented to userspace, a module will be loaded registering a > > > > > driver from a different thread. I don't think thats uncommon. > > > > > > > > But again, what kernel code today does this? I think they all have > > > > locks to keep this from happening, right? > > > I couldn't find a bus who protects device_register against driver_register > > > and I don't think this is something which should be handled by every > > > individual bus but from within the driver core. > > > > How did you cause the oops in this original message? What type of bus > > was it on? And did your patch solve the issue? > > I've seen this warning on a system which had a lot of devices attached. > Those devices also responded _very_ slow. So it took some time to > register all these deivces (qeth) on the bus (ccw). During this time > the qeth module got loaded and registered the qeth driver. > > Since i've never seen this warning and those devices normally don't > take so much time to respond I wrote the beforementioned module to > reproduce the race and make sure that this is no driver issue. > > With this module the warning could be triggered after a few cycles. > With the patch applied, I did not see the warning again even after > > 10.000 cycles. Ok, fair enough. Care to resend the patch again so I can review it once more? thanks, greg k-h