public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Walt H <waltabbyh@comcast.net>
To: Ed Sweetman <ed.sweetman@wmich.edu>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Can't eject a previously mounted CD?
Date: Sun, 28 Dec 2003 19:45:46 -0800	[thread overview]
Message-ID: <3FEFA36A.5050307@comcast.net> (raw)
In-Reply-To: <3FEF8BB1.6090704@wmich.edu>

Ed Sweetman wrote:
> I'd have to say the december 17th listed changes are the culprit here.
> I'm definitely not up to figuring out what change is the bad one.  If
> any of the cdrom/ide-cd people wanna have me get some data from them
> then just tell me how.  I've tried viewing the debug output from the
> modules with no success in figuring out the problem.
> 
> 

Luckily for me, I built my cdrom drivers as modules, so I could play :)
I turned on debugging, and noticed that cdi->use_count continues to increment by
2 for each access. In cdrom_release, only one cdi->use_count-- exists, so the
driver never gets to 0 use count and releases. I noticed in
drivers/cdrom/cdrom.c line 753:

        if (!ret) cdi->use_count++;

Which is our second increment, but I can't find two decrements, because the
check further down won't ever be true if the above is true. Hence, two
increments and only 1 dec when we reach cdrom_release. What I did, was add a
conditional decrement right before the open_for_data call, which makes the value
of use_count like it used to be prior to the Mt. Rainier patches. Seems kinda
hacky :)

-Walt

--- /usr/src/linux/drivers/cdrom/cdrom.c        2003-12-25 09:53:59.000000000 -0800
+++ linux-2.6.0-mm1/drivers/cdrom/cdrom.c       2003-12-28 19:42:04.174098225 -0800
@@ -744,4 +744,7 @@
        }

+       if (cdi->use_count > 0)
+               cdi->use_count--;
+
        /* if this was a O_NONBLOCK open and we should honor the flags,
         * do a quick open without drive/disc integrity checks. */
@@ -931,5 +934,5 @@
        struct cdrom_device_ops *cdo = cdi->ops;

-       cdinfo(CD_CLOSE, "entering cdrom_release\n");
+       cdinfo(CD_CLOSE, "entering cdrom_release\n");

        if (cdi->use_count > 0)




  reply	other threads:[~2003-12-29  3:45 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-29  1:56 Can't eject a previously mounted CD? Walt H
2003-12-29  2:04 ` Ed Sweetman
2003-12-29  3:45   ` Walt H [this message]
2003-12-29  6:23     ` Ed Sweetman
2003-12-29  7:41       ` Ed Sweetman
2003-12-29  7:56     ` Ed Sweetman
2003-12-29 16:36       ` Walt H
2003-12-29 17:53         ` Ed Sweetman
2003-12-29 18:05           ` Walt H
2003-12-29 19:23           ` Walt H
2003-12-29 19:40             ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2003-12-27  0:31 Matt
2003-12-27  0:44 ` Rob Love
2003-12-27  1:13   ` Ed Sweetman
2003-12-27 15:11     ` Matt
2003-12-27  3:12 ` Joshua Kwan
2003-12-26  8:15 Joshua Kwan
2003-12-26 10:34 ` Vojtech Pavlik
2003-12-26 19:44   ` Joshua Kwan
2003-12-26 19:54     ` Samuel Flory
2003-12-26 20:27       ` Joshua Kwan
2003-12-26 23:26         ` Ed Sweetman
2003-12-26 23:56           ` Nuno Silva
2003-12-27  2:28             ` Joshua Kwan
2003-12-29  0:20         ` Samuel Flory
2003-12-29  0:28           ` Ed Sweetman
2003-12-29  1:36             ` Ed Sweetman

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=3FEFA36A.5050307@comcast.net \
    --to=waltabbyh@comcast.net \
    --cc=ed.sweetman@wmich.edu \
    --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