linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Pavel Machek <pavel@suse.cz>
Cc: kernel list <linux-kernel@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-pcmcia@lists.infradead.org, linux-ide@vger.kernel.org,
	Greg KH <greg@kroah.com>
Subject: Re: [regression] Re: 2.6.26-rc6: pcmcia stopped working
Date: Sat, 5 Jul 2008 14:48:40 +0200	[thread overview]
Message-ID: <200807051448.40466.bzolnier@gmail.com> (raw)
In-Reply-To: <20080625221529.GA1600@elf.ucw.cz>


Hi,

On Thursday 26 June 2008, Pavel Machek wrote:
> Hi!
> 
> > > Hmm, hitting sysrq-w produces no blocked task until I eject pcmcia
> > > card. Backtrace there is:
> > > 
> > > Greg, I believe some traces lead to sysfs, can you help here?
> > 
> > ide_unregister() does not complete :-(.
> > 
> >         device_unregister(&hwif->gendev);
> > +       printk("ide_unregister: waiting for rel_comp\n");
> >         wait_for_completion(&hwif->gendev_rel_comp);
> > 
> > ...that wait_for_completion never returns.

[...]

Thanks for narrowing it down to wait_for_completion() call,
it was an useful hint.

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: fix hwif->gendev refcounting

class->dev_release is called by device_release() iff dev->release
is not present so ide_port_class_release() is never called and the
last hwif->gendev reference is not dropped.

Fix it by removing ide_port_class_release() and get_device() call
from ide_register_port() (device_create_drvdata() takes a hwif->gendev
reference anyway).

This patch fixes hang on wait_for_completion(&hwif->gendev_rel_comp)
in ide_unregister() reported by Pavel Machek.

Cc: Pavel Machek <pavel@suse.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-probe.c |    2 --
 drivers/ide/ide.c       |    8 --------
 2 files changed, 10 deletions(-)

Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -646,8 +646,6 @@ static int ide_register_port(ide_hwif_t 
 		goto out;
 	}
 
-	get_device(&hwif->gendev);
-
 	hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev,
 					      MKDEV(0, 0), hwif, hwif->name);
 	if (IS_ERR(hwif->portdev)) {
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1094,13 +1094,6 @@ struct bus_type ide_bus_type = {
 
 EXPORT_SYMBOL_GPL(ide_bus_type);
 
-static void ide_port_class_release(struct device *portdev)
-{
-	ide_hwif_t *hwif = dev_get_drvdata(portdev);
-
-	put_device(&hwif->gendev);
-}
-
 int ide_vlb_clk;
 EXPORT_SYMBOL_GPL(ide_vlb_clk);
 
@@ -1305,7 +1298,6 @@ static int __init ide_init(void)
 		ret = PTR_ERR(ide_port_class);
 		goto out_port_class;
 	}
-	ide_port_class->dev_release = ide_port_class_release;
 
 	init_ide_data();
 

      reply	other threads:[~2008-07-05 12:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080622224022.GA2066@elf.ucw.cz>
     [not found] ` <20080623081309.GA10820@isilmar.linta.de>
     [not found]   ` <20080623081811.GA1850@elf.ucw.cz>
     [not found]     ` <20080623083046.GA12849@isilmar.linta.de>
     [not found]       ` <20080625102347.GA2011@elf.ucw.cz>
2008-06-25 11:01         ` [regression] Re: 2.6.26-rc6: pcmcia stopped working Pavel Machek
2008-06-25 12:03           ` Tejun Heo
2008-06-25 21:53           ` Pavel Machek
2008-06-25 22:09             ` Pavel Machek
2008-06-25 22:15               ` Pavel Machek
2008-07-05 12:48                 ` Bartlomiej Zolnierkiewicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807051448.40466.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=pavel@suse.cz \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).