Skip to content

Commit

Permalink
[SCSI] sd,sr: kill compat SDEV_MEDIA_CHANGE event
Browse files Browse the repository at this point in the history
SDEV_MEDIA_CHANGE event was first added by commit a341cd0 (SCSI: add
asynchronous event notification API) for SATA AN support and then
extended to cover generic media change events by commit 285e967
([SCSI] sr,sd: send media state change modification events).

This event was mapped to block device in userland with all properties
stripped to simulate CHANGE event on the block device, which, in turn,
was used to trigger further userspace action on media change.

The recent addition of disk event framework kept this event for
backward compatibility but it turns out to be unnecessary and causes
erratic and inefficient behavior.  The new disk event generates proper
events on the block devices and the compat events are mapped to block
device with all properties stripped, so the block device ends up
generating multiple duplicate events for single actual event.

This patch removes the compat event generation from both sr and sd as
suggested by Kay Sievers.  Both existing and newer versions of udev
and the associated tools will behave better with the removal of these
events as they from the beginning were expecting events on the block
devices.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
htejun authored and James Bottomley committed Jan 14, 2011
1 parent 2bae009 commit f4013c3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
5 changes: 0 additions & 5 deletions drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,13 +1086,8 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
*
* Medium present state has changed in either direction.
* Device has indicated UNIT_ATTENTION.
*
* Report SDEV_EVT_MEDIA_CHANGE too for backward compatibility.
*/
if (sdp->changed)
sdev_evt_send_simple(sdp, SDEV_EVT_MEDIA_CHANGE, GFP_KERNEL);
kfree(sshdr);

retval = sdp->changed ? DISK_EVENT_MEDIA_CHANGE : 0;
sdp->changed = 0;
return retval;
Expand Down
4 changes: 0 additions & 4 deletions drivers/scsi/sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ static unsigned int sr_check_events(struct cdrom_device_info *cdi,
cd->device->changed = 0;
}

/* for backward compatibility */
if (events & DISK_EVENT_MEDIA_CHANGE)
sdev_evt_send_simple(cd->device, SDEV_EVT_MEDIA_CHANGE,
GFP_KERNEL);
return events;
}

Expand Down

0 comments on commit f4013c3

Please sign in to comment.