From patchwork Tue Mar 25 22:39:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Zummo X-Patchwork-Id: 333734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ee0-x23a.google.com (mail-ee0-x23a.google.com [IPv6:2a00:1450:4013:c00::23a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EFF6514008F for ; Wed, 26 Mar 2014 09:39:42 +1100 (EST) Received: by mail-ee0-f58.google.com with SMTP id b15sf75944eek.23 for ; Tue, 25 Mar 2014 15:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=JNhRhIlsdyCDM/h04f5Vo2QUQvfL3tIyXVsNDZbyTfY=; b=bDGKJEpWpl+ye1+zssETiJ8/U2p9zG2+pgad53fHz3JV4qTWjeCoKn55nCKlGTyrY8 OvPUeQj0jBQFNebT/nhKwri10qhs+vTvb85gY886gN9L7oOUF4r+t71RrxD/QYLxhRER 4kFX7HPfSGistvQvS73ww8IPnIJeFZuprTac64c71s4exioeede3mXuKe3dvXE+9nNnM +Mw//ND36XkuRLDd9K3phM3l3K1kzwFBY9My+z36zag3jQO6K/G0ynX7nXigGyZKE0A2 SQBLeGQELiANnx9EK5It9TiZ/IQFEh3XEYKcxXqDfrgFsFG0FeK4JYIrPIKFRs60YQcQ MeHg== X-Received: by 10.152.210.100 with SMTP id mt4mr30181lac.11.1395787178294; Tue, 25 Mar 2014 15:39:38 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.152.42.172 with SMTP id p12ls68338lal.1.gmail; Tue, 25 Mar 2014 15:39:37 -0700 (PDT) X-Received: by 10.152.234.233 with SMTP id uh9mr33111848lac.1.1395787177635; Tue, 25 Mar 2014 15:39:37 -0700 (PDT) Received: from zabrina.hetzner-de.towertech.it (zabrina.hetzner-de.towertech.it. [178.63.16.19]) by gmr-mx.google.com with ESMTP id m49si2824201eeu.0.2014.03.25.15.39.37 for ; Tue, 25 Mar 2014 15:39:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of a.zummo@towertech.it designates 178.63.16.19 as permitted sender) client-ip=178.63.16.19; Received: from linux.lan.towertech.it (93-50-192-40.ip153.fastwebnet.it [93.50.192.40]) by smtp.towertech.it (Postfix) with ESMTPSA id 3ftnT519Mczn1H; Tue, 25 Mar 2014 23:39:37 +0100 (CET) Date: Tue, 25 Mar 2014 23:39:36 +0100 From: Alessandro Zummo To: Sasha Levin Cc: Tejun Heo , Greg KH , rtc-linux@googlegroups.com, LKML Subject: [rtc-linux] Re: kernfs/rtc: circular dependency between kernfs and ops_lock Message-ID: <20140325233936.655a798e@linux.lan.towertech.it> In-Reply-To: <5331FA9E.20506@oracle.com> References: <5308E3AE.3040405@oracle.com> <20140222205217.GC16272@mtj.dyndns.org> <20140224120427.6394d5dd@linux.lan.towertech.it> <5331FA9E.20506@oracle.com> Organization: Tower Technologies MIME-Version: 1.0 X-Original-Sender: a.zummo@towertech.it X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of a.zummo@towertech.it designates 178.63.16.19 as permitted sender) smtp.mail=a.zummo@towertech.it Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , On Tue, 25 Mar 2014 17:52:30 -0400 Sasha Levin wrote: > > > > Pretty interesting indeed. One option would be to remove > > the sys files before acquiring the lock. But I wonder > > if this could lead to other issues. > > > > Ping? Seems this thing got lost. What if we move rtc_sysfs_del_device(rtc); before acquiring the lock? diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 589351e..a0c19a3 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -261,11 +261,13 @@ EXPORT_SYMBOL_GPL(rtc_device_register); void rtc_device_unregister(struct rtc_device *rtc) { if (get_device(&rtc->dev) != NULL) { + + rtc_sysfs_del_device(rtc); + mutex_lock(&rtc->ops_lock); /* remove innards of this RTC, then disable it, before * letting any rtc_class_open() users access it again */ - rtc_sysfs_del_device(rtc); rtc_dev_del_device(rtc); rtc_proc_del_device(rtc); device_unregister(&rtc->dev);