aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-gd.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-04-21 13:43:59 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-04-21 13:43:59 -0400
commit7eec77a1816a7042591a6cbdb4820e9e7ebffe0e (patch)
tree138c0ed198471151e2590fc3d35f56c5d57ba720 /drivers/ide/ide-gd.c
parent7c88a168da8003fd4d8fb6ae103c4ecf29cb1130 (diff)
ide: unexport DISK_EVENT_MEDIA_CHANGE for ide-gd and ide-cd
check_events() implementations in both ide-gd and ide-cd are inadequate for in-kernel event polling. Both generate media change events continuously when certain conditions are met causing infinite event loop between the driver and userland event handler. As disk event now supports suppression of unlisted events, simply de-listing DISK_EVENT_MEDIA_CHANGE from disk->events resolves the problem. Internal handling around media revalidation will behave the same while userland will fall back to userland event polling after detecting the device doesn't support disk events. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Jens Axboe <jaxboe@fusionio.com> Acked-by: "David S. Miller" <davem@davemloft.net> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/ide/ide-gd.c')
-rw-r--r--drivers/ide/ide-gd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index c4ffd4888939..70ea8763567d 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -298,6 +298,12 @@ static unsigned int ide_gd_check_events(struct gendisk *disk,
298 return 0; 298 return 0;
299 } 299 }
300 300
301 /*
302 * The following is used to force revalidation on the first open on
303 * removeable devices, and never gets reported to userland as
304 * genhd->events is 0. This is intended as removeable ide disk
305 * can't really detect MEDIA_CHANGE events.
306 */
301 ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; 307 ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED;
302 drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; 308 drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED;
303 309
@@ -413,7 +419,6 @@ static int ide_gd_probe(ide_drive_t *drive)
413 if (drive->dev_flags & IDE_DFLAG_REMOVABLE) 419 if (drive->dev_flags & IDE_DFLAG_REMOVABLE)
414 g->flags = GENHD_FL_REMOVABLE; 420 g->flags = GENHD_FL_REMOVABLE;
415 g->fops = &ide_gd_ops; 421 g->fops = &ide_gd_ops;
416 g->events = DISK_EVENT_MEDIA_CHANGE;
417 add_disk(g); 422 add_disk(g);
418 return 0; 423 return 0;
419 424