]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
block: always allocate genhd->ev if check_events is implemented
authorTejun Heo <tj@kernel.org>
Thu, 26 May 2011 19:06:50 +0000 (21:06 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 3 Jun 2011 01:33:46 +0000 (10:33 +0900)
commit 75e3f3ee3c64968d42f4843ec49e579f84b5aa0c upstream.

9fd097b149 (block: unexport DISK_EVENT_MEDIA_CHANGE for legacy/fringe
drivers) removed DISK_EVENT_MEDIA_CHANGE from legacy/fringe block
drivers which have inadequate ->check_events().  Combined with earlier
change 7c88a168da (block: don't propagate unlisted DISK_EVENTs to
userland), this enables using ->check_events() for internal processing
while avoiding enabling in-kernel block event polling which can lead
to infinite event loop.

Unfortunately, this made many drivers including floppy without any bit
set in disk->events and ->async_events in which case disk_add_events()
simply skipped allocation of disk->ev, which disables whole event
handling.  As ->check_events() is still used during open processing
for revalidation, this can lead to open failure.

This patch always allocates disk->ev if ->check_events is implemented.
In the long term, it would make sense to simply include the event
structure inline into genhd as it's now used by virtually all block
devices.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Ondrej Zary <linux@rainbow-software.org>
Reported-by: Alex Villacis Lasso <avillaci@ceibo.fiec.espol.edu.ec>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
block/genhd.c

index cbf1112a885c0c715e4d38a3dfad91f74cd1f1fa..d333f9687eff3c5e3d57d8d00795c1067b2bb5cb 100644 (file)
@@ -1724,7 +1724,7 @@ static void disk_add_events(struct gendisk *disk)
 {
        struct disk_events *ev;
 
-       if (!disk->fops->check_events || !(disk->events | disk->async_events))
+       if (!disk->fops->check_events)
                return;
 
        ev = kzalloc(sizeof(*ev), GFP_KERNEL);