Automatic LUN removal
PATCH 1/1 Automatic LUN removal
From: "Ewan D. Milne" <[email protected]>
This patch adds the capability to configure the kernel to automatically remove LUNs when a rescan of a SCSI target finds that LUNs that were previously reported are no longer being reported. This is only done when a target is scanned using REPORT LUNS, to avoid removing LUNs due to transport errors (in other words, the target must be accessible).
--- drivers/scsi/Kconfig | 8 +++++++ drivers/scsi/scsi_scan.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)
drivers/scsi/Kconfig +8 -0
@@ -292,6 +292,14 @@ config SCSI_ENHANCED_UA primarily useful when storage arrays that can be reconfigured are attached to the system, otherwise you can say N here. +config SCSI_AUTOMATIC_LUN_REMOVAL + bool "Automatic LUN removal" + depends on SCSI + help + If you want LUNs to be automatically removed when a SCSI target + is rescanned and the REPORT LUNS result indicates that LUNs are + no longer present, say Y. Otherwise, say N. + menu "SCSI Transports" depends on SCSI
drivers/scsi/scsi_scan.c +54 -0
66 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 1/1 scsi_debug: Do not respond to INQUIRY commands with CHECK CONDITION when sense pending
From: "Ewan D. Milne" <[email protected]>
According to SPC, INQUIRY commands are not supposed to respond with a CHECK CONDITION due to a pending UNIT ATTENTION. This was causing failures when re-scanning a scsi_debug target.
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
@@ -4060,7 +4060,7 @@ write: errsts = check_condition_result;break ; } -if (!errsts && devip->sense_pending) { +if (!errsts && devip->sense_pending && (*cmd !=INQUIRY )) { devip->sense_pending =0 ; errsts = check_condition_result; }
Signature · 1 line
1.7.11.7
Re: [PATCH] [SCSI] scsi_debug: Do not respond to INQUIRY commands with CHECK CONDITION when sense pending
Quoted 5 lines · Ewan D. Milne
From: "Ewan D. Milne" <[email protected]>
According to SPC, INQUIRY commands are not supposed to respond with a CHECK CONDITION due to a pending UNIT ATTENTION. This was causing failures when re-scanning a
scsi_debugtarget.
Good pick up. Reference: sam5r12.pdf section 5.14 on Unit Attentions. And please add REPORT LUNS to your patch.
Doug Gilbert
Quoted 19 lines
Signed-off-by Ewan D. Milne <[email protected]>--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_debug.c +1
-1@@ -4060,7 +4060,7 @@ write: errsts = check_condition_result;break ; } -if (!errsts && devip->sense_pending) { +if (!errsts && devip->sense_pending && (*cmd !=INQUIRY )) { devip->sense_pending =0 ; errsts = check_condition_result; }
Re: [PATCH] [SCSI] scsi_debug: Do not respond to INQUIRY commands with CHECK CONDITION when sense pending
Quoted 9 lines · Douglas Gilbert
Quoted 5 lines · Ewan D. Milne
From: "Ewan D. Milne" <[email protected]>
According to SPC, INQUIRY commands are not supposed to respond with a CHECK CONDITION due to a pending UNIT ATTENTION. This was causing failures when re-scanning a
scsi_debugtarget.Good pick up. Reference: sam5r12.pdf section 5.14 on Unit Attentions. And please add REPORT LUNS to your patch.
Will do, thanks.
-Ewan
PATCH 1/1 sd: Do not return success from init_sd if DIF mempool allocation fails
In reply to Ewan D. MilneFrom: "Ewan D. Milne" <[email protected]>
init_sd() was returning 0 if sd_cdb_cache or sd_cdb_pool could not be allocated. Return -ENOMEM instead, since the sd_disk_class and the blkdevs will be unregistered if this happens.
--- drivers/scsi/sd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/sd.c +2 -0
@@ -2931,12 +2931,14 @@ static int __init init_sd(void) 0, 0, NULL);if (!sd_cdb_cache) {printk (KERN_ERR "sd: can't init extended cdb cache\n" ); + err = -ENOMEM ; goto err_out_class; } sd_cdb_pool =mempool_create_slab_pool (SD_MEMPOOL_SIZE , sd_cdb_cache);if (!sd_cdb_pool) {printk (KERN_ERR "sd: can't init extended cdb pool\n" ); + err = -ENOMEM ; goto err_out_cache; }
Signature · 1 line
1.7.11.7
Re: [PATCH] [SCSI] sd: Do not return success from init_sd if DIF mempool allocation fails
Quoted 20 lines · Ewan D. Milne
From: "Ewan D. Milne" <[email protected]>
init_sd()was returning 0 ifsd_cdb_cacheorsd_cdb_poolcould not be allocated. Return-ENOMEMinstead, since thesd_disk_classand the blkdevs will be unregistered if this happens.Signed-off-by Ewan D. Milne <[email protected]>--- drivers/scsi/sd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/scsi/sd.c +1
-0@@ -2931,12 +2931,14 @@ static int __init init_sd(void) 0, 0, NULL);if (!sd_cdb_cache) {printk (KERN_ERR "sd: can't init extended cdb cache\n" ); + err = -ENOMEM ;
drivers/scsi/sd.c static int __init init_sd(void) · line 2944
Quoted 10 lines
drivers/scsi/sd.c +1
-0goto err_out_class; } sd_cdb_pool =mempool_create_slab_pool (SD_MEMPOOL_SIZE , sd_cdb_cache);if (!sd_cdb_pool) {printk (KERN_ERR "sd: can't init extended cdb pool\n" ); + err = -ENOMEM ; goto err_out_cache; }
Would someone mind looking at this patch and ACKing it if you feel it is appropriate?
Thanks.
-Ewan D. Milne <[email protected]>