public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: always allocate genhd->ev if check_events is implemented
@ 2011-05-25 21:06 Tejun Heo
  2011-05-26 19:08 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2011-05-25 21:06 UTC (permalink / raw)
  To: axboe; +Cc: Andrew Morton, linux-kernel, linux

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>
Cc: stable@kernel.org
---
 block/genhd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/genhd.c b/block/genhd.c
index 2dd9887..95822ae 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1728,7 +1728,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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: always allocate genhd->ev if check_events is  implemented
  2011-05-25 21:06 [PATCH] block: always allocate genhd->ev if check_events is implemented Tejun Heo
@ 2011-05-26 19:08 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2011-05-26 19:08 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Andrew Morton, linux-kernel, linux

On 2011-05-25 23:06, Tejun Heo wrote:
> 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.

Thanks, applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-26 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-25 21:06 [PATCH] block: always allocate genhd->ev if check_events is implemented Tejun Heo
2011-05-26 19:08 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox