From 3abfda9ec0aa0f614eb50899bcf2b5ac0a455719 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 4 May 2017 02:36:37 +0000 Subject: [PATCH 1/3] scstadmin: Fix a few bugs in the regression test code git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7166 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/scstadmin.sysfs/scst-1.0.0/t/01-start-scst.t | 3 +-- scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-result.conf | 4 +--- scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-scstadmin-args.t | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scstadmin/scstadmin.sysfs/scst-1.0.0/t/01-start-scst.t b/scstadmin/scstadmin.sysfs/scst-1.0.0/t/01-start-scst.t index e7ebc9b4d..34bf666bb 100644 --- a/scstadmin/scstadmin.sysfs/scst-1.0.0/t/01-start-scst.t +++ b/scstadmin/scstadmin.sysfs/scst-1.0.0/t/01-start-scst.t @@ -25,7 +25,6 @@ if ($> == 0) { ok(system("modprobe scst_local add_default_tgt=0 && " . "modprobe iscsi-scst && " . "modprobe ib_srpt && " . - "modprobe qla2x00tgt && " . "modprobe scst_vdisk && " . - "iscsi-scstd"), 0); + "../../../iscsi-scst/usr/iscsi-scstd"), 0); } diff --git a/scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-result.conf b/scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-result.conf index 8bee55a95..b650ac13b 100644 --- a/scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-result.conf +++ b/scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-result.conf @@ -14,9 +14,7 @@ HANDLER vdisk_fileio { } HANDLER vdisk_nullio { - DEVICE nodev { - dummy 1 - } + DEVICE nodev } TARGET_DRIVER scst_local { diff --git a/scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-scstadmin-args.t b/scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-scstadmin-args.t index 58e149049..754fd7d1f 100644 --- a/scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-scstadmin-args.t +++ b/scstadmin/scstadmin.sysfs/scst-1.0.0/t/07-scstadmin-args.t @@ -68,7 +68,8 @@ sub attributeTest { system("$scstadmin -driver scst_local -target local -group ig " . "-add_lun 1 -device disk1 $redirect"); system("$scstadmin -write_config $tmpfilename1 >/dev/null"); - system("awk 'BEGIN { t = 0 } /^# Automatically generated by SCST Configurator v/ { \$0 = \"# Automatically generated by SCST Configurator v...\" } /^TARGET_DRIVER.*{\$/ { if (\$0 != \"TARGET_DRIVER scst_local {\") t = 1 } /^}\$/ { if (t == 1) t = 2 } /^\$/ { if (t == 2) { t = 3 } } /^./ { if (t == 3) { t = 0 } } { if (t == 0) print }' <$tmpfilename1 >$tmpfilename2"); + # Keep only the scst_local target driver information. + system("awk 'BEGIN { t = 0 } /^# Automatically generated by SCST Configurator v/ { \$0 = \"# Automatically generated by SCST Configurator v...\" } /^TARGET_DRIVER.*{\$/ { if (match(\$0, \"TARGET_DRIVER ([^ ]*) {\", d) && d[1] != \"scst_local\") t = 1 } /^}\$/ { if (t == 1) t = 2 } /^\$/ { if (t == 2) { t = 3 } } /^./ { if (t == 3) { t = 0 } } { if (t == 0) print }' <$tmpfilename1 >$tmpfilename2"); my $compare_result = system("diff -u $tmpfilename2 $expected >$diff"); ok($compare_result, 0); if ($compare_result == 0) { From 386cd25f980eb1a33adee75551eaf40b35e8d8bb Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 4 May 2017 02:45:35 +0000 Subject: [PATCH 2/3] scst_lib: Convert a comment into a runtime check git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7167 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 3bf505191..64424306f 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2753,13 +2753,16 @@ out: return; } -/* The activity supposed to be suspended and scst_mutex held */ void scst_report_luns_changed(struct scst_acg *acg) { struct scst_session *sess; TRACE_ENTRY(); + /* To protect acg_sess_list */ + scst_assert_activity_suspended(); + lockdep_assert_held(&scst_mutex); + TRACE_DBG("REPORTED LUNS DATA CHANGED (acg %s)", acg->acg_name); list_for_each_entry(sess, &acg->acg_sess_list, acg_sess_list_entry) { From d1ad88a861814be13c069261fb8b8c18f6ded33d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 4 May 2017 02:56:27 +0000 Subject: [PATCH 3/3] scst: Fix build for kernels before v2.6.39 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7168 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scst/include/backport.h b/scst/include/backport.h index 21542ef27..8cb0198cb 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -23,6 +23,7 @@ #include /* struct request_queue */ #include /* struct scatterlist */ #include /* kmalloc() */ +#include #include /* sync_page_range() */ #include /* struct scsi_cmnd */ #include @@ -647,6 +648,15 @@ struct t10_pi_tuple { }; #endif +/* */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) +#ifndef kthread_create +#define kthread_create_on_node(threadfn, data, node, namefmt, arg...) \ + kthread_create((threadfn), (data), (namefmt), ##arg) +#endif +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)