linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: martin@dalecki.de
Cc: linux-kernel@vger.kernel.org
Subject: Patch: linux-2.5.21/drivers/ide-disk.c crashed at shutdown
Date: Thu, 13 Jun 2002 02:37:55 -0700	[thread overview]
Message-ID: <200206130937.CAA23202@adam.yggdrasil.com> (raw)

	There are two reasons why ide-disk crashes at system shutdown.

1. idedisk_devdrv.lock is not initialized (RW_LOCK_UNLOCKED is not all
    zeroes on x86).

2. The ide-disk module "manually" sets device->driver, but
   drivers/base/core.c assumes that if device->driver != NULL then
   a bunch of other fields also have valid data (driver->driver_list,
   for example).  In this patch, I just clear drive->device.driver
   before calling put_device as a first step.  Eventually, I would
   like to use {driver,device}_register than their generic
   matching facility, but that might take a day to get right and
   I would like to get this first step into the kernel tree and
   get your input on this idea.

	In my patch, I also reindented the fields for idedisk_devdrv.
It's just a suggestion.

	I'll cc this to linux-kernel since others have reported
this kernel BUG().

	By the way, with this patch I now get a crash at about
the same time in usbdevfs, but I believe that is not part of
this problem.


Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

--- linux-2.5.21/drivers/ide/ide-disk.c 2002-06-08 22:26:29.000000000 -0700
+++ linux/drivers/ide/ide-disk.c        2002-06-13 02:08:46.000000000 -0700
@@ -822,8 +822,9 @@
  */
 
 static struct device_driver idedisk_devdrv = {
-       suspend: idedisk_suspend,
-       resume: idedisk_resume,
+       suspend:        idedisk_suspend,
+       resume:         idedisk_resume,
+       lock:           RW_LOCK_UNLOCKED,
 };
 
 /*
@@ -1196,6 +1197,9 @@
        if (!drive)
            return 0;
 
+       /* Kludge: we never registered with device_attach, so prevent
+          put_device from trying to remove us from device->driver_list */
+       drive->device.driver = NULL;
        put_device(&drive->device);
        if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
                if (idedisk_flushcache(drive))


                 reply	other threads:[~2002-06-13  9:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200206130937.CAA23202@adam.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@dalecki.de \
    /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).