]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit - fs/block_dev.c
block: rescan partitions on invalidated devices on -ENOMEDIA too
authorTejun Heo <tj@kernel.org>
Thu, 21 Apr 2011 18:54:45 +0000 (20:54 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Thu, 21 Apr 2011 18:54:45 +0000 (20:54 +0200)
commit1196f8b814f32cd04df334abf47648c2a9fd8324
tree851592da601be9fe51903a49c8da460fab69b487
parentea6949b66d084a197dd7f243b72e216a71d9f2ca
block: rescan partitions on invalidated devices on -ENOMEDIA too

__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: Tejun Heo <tj@kernel.org>
Reported-by: David Zeuthen <zeuthen@gmail.com>
Reported-by: Martin Pitt <martin.pitt@ubuntu.com>
Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Tested-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
fs/block_dev.c