[partially fixed in cciss patches]: add new helpers: diskdump_sysfs_store_disk() and diskdump_sysfs_show_disk() (patch is in cciss series). Convert scsi_dump and ide_dump to those; as it is, device_to_gendisk() is both racy (it returns gendisk without pinning it down) and atrocious - callers know the gendisk since they have pointer to it in their structures, so there's no reason to do pathname resolution to get it. We can't remove the old helpers, but we certainly can switch to saner and cheaper variants ourselves.
I think diskdump_sysfs_show_disk() Is better interface (and I agree current code is very ugly). About poring to scsi, retrieving gendisk from scsi_dump is possible by using dev_get_drvdata(dev). It returns struct scsi_disk and gendisk is pointed from gendisk field of scsi_disk. scsi_disk is internal structure of sd.c. so sd.c may have function to retrieve gendisk from struct device and export this function. One problem I cannot solve is that dev_get_drvdata(dev) may return other structure like scsi_cd. I cannot find any way to determine if driver_data field points scsi_disk structure.
Created attachment 127151 [details] linux-2.6.9-diskdump-ide-showdisk.patch I made the patch which changes ide diskdump to use diskdump_sysfs_show_disk(), which will be include with cciss diskdump. The test was done on my i386 box.
struct scsi_disk { struct scsi_driver *driver; /* always &sd_template */ typedef struct scsi_cd { struct scsi_driver *driver; and that always point to sr_template. And no, that's not an accident. The tricky part is access to drvdata; specifically, the locking needed for that - in 2.6.9-based trees it's different from current mainline and that's what I'm looking into.
This issue is on Red Hat Engineering's list of planned work items for the upcoming Red Hat Enterprise Linux 4.4 release. Engineering resources have been assigned and barring unforeseen circumstances, Red Hat intends to include this item in the 4.4 release.
committed in stream U4 build 34.21. A test kernel with this patch is available from http://people.redhat.com/~jbaron/rhel4/
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2006-0575.html