Commit 91e8549b authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  ide: unexport DISK_EVENT_MEDIA_CHANGE for ide-gd and ide-cd
  block: don't propagate unlisted DISK_EVENTs to userland
  elevator: check for ELEVATOR_INSERT_SORT_MERGE in !elvpriv case too
parents 37fc67c9 7eec77a1
...@@ -671,7 +671,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) ...@@ -671,7 +671,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where)
q->boundary_rq = rq; q->boundary_rq = rq;
} }
} else if (!(rq->cmd_flags & REQ_ELVPRIV) && } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
where == ELEVATOR_INSERT_SORT) (where == ELEVATOR_INSERT_SORT ||
where == ELEVATOR_INSERT_SORT_MERGE))
where = ELEVATOR_INSERT_BACK; where = ELEVATOR_INSERT_BACK;
switch (where) { switch (where) {
......
...@@ -1588,9 +1588,13 @@ static void disk_events_workfn(struct work_struct *work) ...@@ -1588,9 +1588,13 @@ static void disk_events_workfn(struct work_struct *work)
spin_unlock_irq(&ev->lock); spin_unlock_irq(&ev->lock);
/* tell userland about new events */ /*
* Tell userland about new events. Only the events listed in
* @disk->events are reported. Unlisted events are processed the
* same internally but never get reported to userland.
*/
for (i = 0; i < ARRAY_SIZE(disk_uevents); i++) for (i = 0; i < ARRAY_SIZE(disk_uevents); i++)
if (events & (1 << i)) if (events & disk->events & (1 << i))
envp[nr_events++] = disk_uevents[i]; envp[nr_events++] = disk_uevents[i];
if (nr_events) if (nr_events)
......
...@@ -1782,7 +1782,6 @@ static int ide_cd_probe(ide_drive_t *drive) ...@@ -1782,7 +1782,6 @@ static int ide_cd_probe(ide_drive_t *drive)
ide_cd_read_toc(drive, &sense); ide_cd_read_toc(drive, &sense);
g->fops = &idecd_ops; g->fops = &idecd_ops;
g->flags |= GENHD_FL_REMOVABLE; g->flags |= GENHD_FL_REMOVABLE;
g->events = DISK_EVENT_MEDIA_CHANGE;
add_disk(g); add_disk(g);
return 0; return 0;
......
...@@ -79,6 +79,12 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr) ...@@ -79,6 +79,12 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr)
return CDS_DRIVE_NOT_READY; return CDS_DRIVE_NOT_READY;
} }
/*
* ide-cd always generates media changed event if media is missing, which
* makes it impossible to use for proper event reporting, so disk->events
* is cleared to 0 and the following function is used only to trigger
* revalidation and never propagated to userland.
*/
unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi,
unsigned int clearing, int slot_nr) unsigned int clearing, int slot_nr)
{ {
......
...@@ -298,6 +298,12 @@ static unsigned int ide_gd_check_events(struct gendisk *disk, ...@@ -298,6 +298,12 @@ static unsigned int ide_gd_check_events(struct gendisk *disk,
return 0; return 0;
} }
/*
* The following is used to force revalidation on the first open on
* removeable devices, and never gets reported to userland as
* genhd->events is 0. This is intended as removeable ide disk
* can't really detect MEDIA_CHANGE events.
*/
ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED;
drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED;
...@@ -413,7 +419,6 @@ static int ide_gd_probe(ide_drive_t *drive) ...@@ -413,7 +419,6 @@ static int ide_gd_probe(ide_drive_t *drive)
if (drive->dev_flags & IDE_DFLAG_REMOVABLE) if (drive->dev_flags & IDE_DFLAG_REMOVABLE)
g->flags = GENHD_FL_REMOVABLE; g->flags = GENHD_FL_REMOVABLE;
g->fops = &ide_gd_ops; g->fops = &ide_gd_ops;
g->events = DISK_EVENT_MEDIA_CHANGE;
add_disk(g); add_disk(g);
return 0; return 0;
......
Markdown is supported
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