diff -uNr linux-2.4.21/drivers/scsi/scsi_scan.c linux-2.4.21.ghost/drivers/scsi/scsi_scan.c --- linux-2.4.21/drivers/scsi/scsi_scan.c 2003-08-25 13:00:17.000000000 +0200 +++ linux-2.4.21.ghost/drivers/scsi/scsi_scan.c 2003-08-25 13:03:30.000000000 +0200 @@ -256,6 +256,7 @@ return 0; } +static int scsi_allow_ghost_devices; static int scsi_sparselun; static int scsi_largelun; @@ -289,6 +290,9 @@ MODULE_PARM(max_scsi_sparseluns, "i"); MODULE_PARM_DESC(max_scsi_sparseluns, "Limit LUNs for scanning sparse LUN devices"); +MODULE_PARM(scsi_allow_ghost_devices, "i"); +MODULE_PARM_DESC(scsi_allow_ghost_devices, "allow devices marked as being offline to be accessed anyway (0 = off, else allow ghosts on lun 0 through allow_ghost_devices - 1"); + MODULE_PARM(scsi_noreportlun, "i"); MODULE_PARM_DESC(scsi_noreportlun, "Don't use REPORT_LUNs for scanning SCSI-3 devs"); @@ -387,6 +391,21 @@ __setup("max_scsi_sparseluns=", scsi_max_sparseluns_setup); +static int __init scsi_allow_ghost_devices_setup(char *str) +{ + unsigned int tmp; + + if (get_option(&str, &tmp) == 1) { + scsi_allow_ghost_devices = tmp; + return 1; + } else { + printk("scsi_allow_ghost_devices_setup: usage scsi_allow_ghost_devices=n (0: off else\nallow ghost devices (ghost devices are devices that report themselves as\nbeing offline but which we allow access to anyway) on lun 0 through n - 1.\n"); + return 0; + } +} + +__setup("scsi_allow_ghost_devices=", scsi_allow_ghost_devices_setup); + static int __init scsi_noreplun_setup(char *str) { unsigned int tmp; @@ -1013,8 +1032,11 @@ SDpnt->removable = (0x80 & scsi_result[1]) >> 7; /* Use the peripheral qualifier field to determine online/offline */ - if (((scsi_result[0] >> 5) & 7) == 1) SDpnt->online = FALSE; - else SDpnt->online = TRUE; + if ((((scsi_result[0] >> 5) & 7) == 1) && + (SDpnt->lun >= scsi_allow_ghost_devices)) + SDpnt->online = FALSE; + else + SDpnt->online = TRUE; SDpnt->lockable = SDpnt->removable; SDpnt->changed = 0; SDpnt->access_count = 0;