Skip to content
Commit 339defb7 authored by Tejun Heo's avatar Tejun Heo Committed by Herton Ronaldo Krzesinski
Browse files

block: rescan partitions on invalidated devices on -ENOMEDIA too



BugLink: http://bugs.launchpad.net/bugs/802383

commit 02e352287a40bd456eb78df705bf888bc3161d3f upstream.

__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

Stable: 2.6.38

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Reported-by: default avatarDavid Zeuthen <zeuthen@gmail.com>
Reported-by: default avatarMartin Pitt <martin.pitt@ubuntu.com>
Reported-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Tested-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 28503eb7
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment