* [PATCH] scsi: properly export media change notification capability in block device flags
@ 2009-10-11 19:54 Robert Hancock
2009-10-11 20:12 ` Robert Hancock
0 siblings, 1 reply; 2+ messages in thread
From: Robert Hancock @ 2009-10-11 19:54 UTC (permalink / raw)
To: linux-kernel, linux-scsi; +Cc: stable
Due to some oversight, the SCSI capability for reporting media change
notifications was never actually translated into setting the appropriate
GENHD_FL_MEDIA_CHANGE_NOTIFY flag. HAL uses this flag to detect whether the
block device supports change notifications and so it never actually got
detected. Set the flag when appropriate in sd and sr.
Signed-off-by: Robert Hancock <hancockrwd@gmail.com>
---
Gaah, am I disappointed in finding this one. Apparently people went to the
trouble of adding ATAPI AN support, and adding the appropriate flags to indicate
to userspace that it was supported, but nobody ever tested to make sure that
the support worked all the way through to actually make HAL stop polling
optical drives that support AN, which to my dismay, it doesn't. In fact even
with this patch it still doesn't seem to, but that's presumably some HAL bug.
HAL does now report that storage.removable.support_async_notification = true,
however.
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8dd96dc..c1f474e 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2012,6 +2012,8 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
gd->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DRIVERFS;
if (sdp->removable)
gd->flags |= GENHD_FL_REMOVABLE;
+ if (test_bit(SDEV_EVT_MEDIA_CHANGE, sdp->supported_events))
+ gd->flags |= GENHD_FL_MEDIA_CHANGE_NOTIFY;
dev_set_drvdata(dev, sdkp);
add_disk(gd);
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index eb61f7a..485898e 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -642,6 +642,8 @@ static int sr_probe(struct device *dev)
dev_set_drvdata(dev, cd);
disk->flags |= GENHD_FL_REMOVABLE;
+ if (test_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events))
+ disk->flags |= GENHD_FL_MEDIA_CHANGE_NOTIFY;
add_disk(disk);
sdev_printk(KERN_DEBUG, sdev,
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: properly export media change notification capability in block device flags
2009-10-11 19:54 [PATCH] scsi: properly export media change notification capability in block device flags Robert Hancock
@ 2009-10-11 20:12 ` Robert Hancock
0 siblings, 0 replies; 2+ messages in thread
From: Robert Hancock @ 2009-10-11 20:12 UTC (permalink / raw)
To: linux-kernel, linux-scsi; +Cc: stable
On 10/11/2009 01:54 PM, Robert Hancock wrote:
> Due to some oversight, the SCSI capability for reporting media change
> notifications was never actually translated into setting the appropriate
> GENHD_FL_MEDIA_CHANGE_NOTIFY flag. HAL uses this flag to detect whether the
> block device supports change notifications and so it never actually got
> detected. Set the flag when appropriate in sd and sr.
>
> Signed-off-by: Robert Hancock<hancockrwd@gmail.com>
>
> ---
>
> Gaah, am I disappointed in finding this one. Apparently people went to the
> trouble of adding ATAPI AN support, and adding the appropriate flags to indicate
> to userspace that it was supported, but nobody ever tested to make sure that
> the support worked all the way through to actually make HAL stop polling
> optical drives that support AN, which to my dismay, it doesn't. In fact even
> with this patch it still doesn't seem to, but that's presumably some HAL bug.
> HAL does now report that storage.removable.support_async_notification = true,
> however.
To follow up on the above, from what I can see from the HAL code, it has
code to detect the capability from sysfs and set its flag, but there's
no code to actually disable polling based on the flag. Seems like plenty
of epic fail to go around on this one :-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-11 20:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-11 19:54 [PATCH] scsi: properly export media change notification capability in block device flags Robert Hancock
2009-10-11 20:12 ` Robert Hancock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).