From patchwork Thu Sep 2 21:28:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 63557 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 58AD5B7170 for ; Fri, 3 Sep 2010 07:28:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753777Ab0IBV2l (ORCPT ); Thu, 2 Sep 2010 17:28:41 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:36611 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753478Ab0IBV2k (ORCPT ); Thu, 2 Sep 2010 17:28:40 -0400 Received: from octopus.hi.pengutronix.de ([2001:6f8:1178:2:215:17ff:fe12:23b0]) by metis.ext.pengutronix.de with esmtp (Exim 4.71) (envelope-from ) id 1OrHKp-0003V8-Qf; Thu, 02 Sep 2010 23:28:39 +0200 Received: from wsa by octopus.hi.pengutronix.de with local (Exim 4.69) (envelope-from ) id 1OrHKp-0006WE-6h; Thu, 02 Sep 2010 23:28:39 +0200 Date: Thu, 2 Sep 2010 23:28:39 +0200 From: Wolfram Sang To: David Miller Cc: linux-ide@vger.kernel.org, Bartlomiej Zolnierkiewicz Subject: Re: WARNINGs because of ide-proc handling Message-ID: <20100902212839.GA20070@pengutronix.de> References: <20100831205605.GA23636@pengutronix.de> <20100901.193332.77341159.davem@davemloft.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100901.193332.77341159.davem@davemloft.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-SA-Exim-Connect-IP: 2001:6f8:1178:2:215:17ff:fe12:23b0 X-SA-Exim-Mail-From: wsa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-ide@vger.kernel.org Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org On Wed, Sep 01, 2010 at 07:33:32PM -0700, David Miller wrote: Adding Bartlomiej to CC, maybe he has something to add :) > From: Wolfram Sang > Date: Tue, 31 Aug 2010 22:56:05 +0200 > > > Hello, > > > > I get the following warning (and some similar ones) on my laptop running > > 2.6.36-rc3 when removing a CF card via pcmcia: > > > > [ 1087.602129] WARNING: at fs/proc/generic.c:816 remove_proc_entry+0x185/0x1d0() > > [ 1087.602137] Hardware name: Amilo M14255 > > [ 1087.602142] name 'cache' > > ... > > > > It turned out that none of the entries in ide_disk_proc[] gets created when > > inserting the card, so trying to remove them triggers this warning. Adding > > some debug printouts > > Hmmm, at some point ide_host_add() or ide_host_register() should be invoked, > which should create the drive->proc and hwif->proc PROCFS directories. > > What driver is your pcmcia IDE card using? ide-cs. I did some more debugging and have a function_graph-trace which proves the following callchain: ide_host_add -> ... -> ide_host_register This calls _first_ hwif_register_devices() and only _later_ ide_proc_register_port() and ide_proc_port_register_devices() which are responsible for creating the needed directories. In hwif_register_devices(), a device gets created and immediately attached to the driver, ide-gd in this case. The probe-function calls disk_ops->setup() which wants to create the proc-entries, but the directories are not there yet. This patch helps, combining two loops and moving hwif_register_devices() to the end: Dunno, if it is correct, though. The strange thing is that the code is like this for two years and, surprisingly, I don't see the problem with 2.6.33. Also, the proc-entry for my hard-disk is fine. I can't see any suspicious commits in the ide-directory except maybe the BKL pushdown had a side-effect regarding the serialization of the sequence? Ah, too late today to seriously think about such issues... Thanks for the input, Wolfram diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 4c3d1bf..068cef0 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1448,19 +1448,13 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, if (hwif == NULL) continue; - if (hwif->present) - hwif_register_devices(hwif); - } - - ide_host_for_each_port(i, hwif, host) { - if (hwif == NULL) - continue; - ide_sysfs_register_port(hwif); ide_proc_register_port(hwif); - if (hwif->present) + if (hwif->present) { ide_proc_port_register_devices(hwif); + hwif_register_devices(hwif); + } } return j ? 0 : -1;