1. 22 4月, 2011 2 次提交
    • T
      block: rescan partitions on invalidated devices on -ENOMEDIA too · 1196f8b8
      Tejun Heo 提交于
      __blkdev_get() doesn't rescan partitions if disk->fops->open() fails,
      which leads to ghost partition devices lingering after medimum removal
      is known to both the kernel and userland.  The behavior also creates a
      subtle inconsistency where O_NONBLOCK open, which doesn't fail even if
      there's no medium, clears the ghots partitions, which is exploited to
      work around the problem from userland.
      
      Fix it by updating __blkdev_get() to issue partition rescan after
      -ENOMEDIA too.
      
      This was reported in the following bz.
      
       https://bugzilla.kernel.org/show_bug.cgi?id=13029
      
      Note for stable: 2.6.38 and later only
      
      Cc: stable@kernel.org
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NDavid Zeuthen <zeuthen@gmail.com>
      Reported-by: NMartin Pitt <martin.pitt@ubuntu.com>
      Reported-by: NKay Sievers <kay.sievers@vrfy.org>
      Tested-by: NKay Sievers <kay.sievers@vrfy.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      1196f8b8
    • T
      cdrom: always check_disk_change() on open · ea6949b6
      Tejun Heo 提交于
      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.
      
      Note for stable: 2.6.38 and later only
      
      Cc: stable@kernel.org
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NAmit Shah <amit.shah@redhat.com>
      Tested-by: NAmit Shah <amit.shah@redhat.com>
      Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
      ea6949b6
  2. 19 4月, 2011 10 次提交
  3. 18 4月, 2011 26 次提交
  4. 17 4月, 2011 2 次提交