diff options
author | Tejun Heo <tj@kernel.org> | 2011-04-21 20:54:44 +0200 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-04-21 20:54:44 +0200 |
commit | ea6949b66d084a197dd7f243b72e216a71d9f2ca (patch) | |
tree | a8a25ba6eda76d3172c4dc550d65335f2ebb128b /kernel | |
parent | f0e615c3cb72b42191b558c130409335812621d8 (diff) | |
download | op-kernel-dev-ea6949b66d084a197dd7f243b72e216a71d9f2ca.zip op-kernel-dev-ea6949b66d084a197dd7f243b72e216a71d9f2ca.tar.gz |
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.
Note for stable: 2.6.38 and later only
Cc: stable@kernel.org
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Amit Shah <amit.shah@redhat.com>
Tested-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions