From: Alex Davis <alex14641@yahoo.com>
To: Andre Hedrick <andre@linux-ide.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Possible bug and question about ide_notify_reboot in 2.4.19
Date: Sun, 15 Sep 2002 00:40:13 -0700 (PDT) [thread overview]
Message-ID: <20020915074013.87184.qmail@web40514.mail.yahoo.com> (raw)
In-Reply-To: <Pine.LNX.4.10.10209141548370.6925-100000@master.linux-ide.org>
--- Andre Hedrick <andre@linux-ide.org> wrote:
> > > You said you can make a patch, please do so and apply it to your tree.
> > > Now, if you want the option, submit the patch for review. For two or
> > > three days there has been no patch to test.
> > Still testing locally. I also want to fix the code so that the flush is
> > done before the standby.
>
> Wait, how did the order go south?
>
I don't know how, but I know it happened somewhere between 2.4.18 and 2.4.19.
This is a snippet of code from the ide_notify_reboot() function in ide.c in
2.4.19 vanilla:
4024 for (unit = 0; unit < MAX_DRIVES; ++unit) {
4025 drive = &hwif->drives[unit];
4026 if (!drive->present)
4027 continue;
4028
4029 /* set the drive to standby */
4030 printk("%s ", drive->name);
4031 if (event != SYS_RESTART)
4032 if (drive->driver != NULL && DRIVER(drive)->standby(drive))
4033 continue;
4034
4035 if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
4036 continue;
4037 }
Notice that we are calling standby(), then cleanup(): standby() puts the disk
to sleep, but cleanup flushes the cache.
Here is the code for standby() from ide_disk.c in 2.4.19 vanilla:
1235 static int do_idedisk_standby (ide_drive_t *drive) // put disk to sleep.
1236 {
1237 struct hd_drive_task_hdr taskfile;
1238 struct hd_drive_hob_hdr hobfile;
1239 memset(&taskfile, 0, sizeof(struct hd_drive_task_hdr));
1240 memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
1241 taskfile.command = WIN_STANDBYNOW1;
1242 return ide_wait_taskfile(drive, &taskfile, &hobfile, NULL);
1243 }
Now here's the cleanup() function:
1420 static int idedisk_cleanup (ide_drive_t *drive)
1421 {
1422 if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
1423 if (do_idedisk_flushcache(drive))
1424 printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
1425 drive->name);
1426 return ide_unregister_subdriver(drive);
1427 }
--------------------------------------------------------------------------
Looking at this snippet of the the first snippet
4031 if (event != SYS_RESTART)
4032 if (drive->driver != NULL && DRIVER(drive)->standby(drive))
4033 continue;
4034
4035 if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
4036 continue;
I also see another potential bug (actually, the original bug I posted about):
standby() returns 0 on success, and non-zero on failure. By this logic, if
standby() fails then cleanup() won't get called.
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
prev parent reply other threads:[~2002-09-15 7:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-14 18:28 Alex Davis
2002-09-14 19:32 ` Alan Cox
2002-09-14 19:52 ` Alex Davis
2002-09-14 21:14 ` Andre Hedrick
2002-09-14 20:57 ` Andre Hedrick
2002-09-14 21:41 ` Alex Davis
2002-09-15 4:16 ` Andre Hedrick
2002-09-15 7:40 ` Alex Davis [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=20020915074013.87184.qmail@web40514.mail.yahoo.com \
--to=alex14641@yahoo.com \
--cc=andre@linux-ide.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®