lkml.org 
[lkml]   [2003]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: Can't eject a previously mounted CD?
    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)


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:59    [W:0.025 / U:2.548 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site