Jameson Graef Rollins wrote:

> If I keep everything else the same (same version of udev) I do *not*
> experience the problem with kernel:
>
> 2.6.38-2-amd64
>
> but I *do* experience the problem with kernels:
>
> 2.6.39-2-amd64
> 3.0.0-1-amd64
>
> If you really think it's worthwhile to try downgrading udev let me know,

Nah, that shouldn't be necessary.  Thanks for figuring out the kernel
regression range.

The only potentially problematic commit I could find is the following.
It might be worth testing with it backed out.

commit bf2253a6f00e
Author: Tejun Heo <[email protected]>
Date:   Fri Apr 29 10:15:14 2011 +0200

    cdrom: always check_disk_change() on open
    
    cdrom_open() called check_disk_change() after the rest of open path
    succeeded which leads to the following bizarre behavior.
    
    * After media change, if the device opened without O_NONBLOCK,
      open_for_data() naturally fails with -ENOMEDIA and
      check_disk_change() is never called.  The media is known to be gone
      and the open failure makes it obvious to the userland but device
      invalidation never happens.
    
    * But if the device is opened with O_NONBLOCK, all the checks are
      bypassed and cdrom_open() doesn't notice that the media is not there
      and check_disk_change() is called and invalidation happens.
    
    There's nothing to be gained by avoiding calling check_disk_change()
    on open failure.  Common cases end up calling check_disk_change()
    anyway.  All we get is inconsistent behavior.
    
    Fix it by moving check_disk_change() invocation to the top of
    cdrom_open() so that it always gets called regardless of how the rest
    of open proceeds.
    
    Stable: 2.6.38
    
    Signed-off-by: Tejun Heo <[email protected]>
    Reported-by: Amit Shah <[email protected]>
    Tested-by: Amit Shah <[email protected]>
    Cc: [email protected]
    Signed-off-by: Jens Axboe <[email protected]>

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 514dd8efaf73..75fb965b8f72 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -986,6 +986,9 @@ int cdrom_open(struct cdrom_device_info *cdi, struct 
block_device *bdev, fmode_t
 
        cdinfo(CD_OPEN, "entering cdrom_open\n"); 
 
+       /* open is event synchronization point, check events first */
+       check_disk_change(bdev);
+
        /* if this was a O_NONBLOCK open and we should honor the flags,
         * do a quick open without drive/disc integrity checks. */
        cdi->use_count++;
@@ -1012,9 +1015,6 @@ int cdrom_open(struct cdrom_device_info *cdi, struct 
block_device *bdev, fmode_t
 
        cdinfo(CD_OPEN, "Use count for \"/dev/%s\" now %d\n",
                        cdi->name, cdi->use_count);
-       /* Do this on open.  Don't wait for mount, because they might
-           not be mounting, but opening with O_NONBLOCK */
-       check_disk_change(bdev);
        return 0;
 err_release:
        if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to