@@ -816,7 +816,7 @@ static int sdebug_cylinders_per; /* cylinders per surface */
816816static int sdebug_sectors_per ; /* sectors per cylinder */
817817
818818static LIST_HEAD (sdebug_host_list );
819- static DEFINE_SPINLOCK ( sdebug_host_list_lock );
819+ static DEFINE_MUTEX ( sdebug_host_list_mutex );
820820
821821static struct xarray per_store_arr ;
822822static struct xarray * per_store_ap = & per_store_arr ;
@@ -908,7 +908,7 @@ static void sdebug_max_tgts_luns(void)
908908 struct sdebug_host_info * sdbg_host ;
909909 struct Scsi_Host * hpnt ;
910910
911- spin_lock ( & sdebug_host_list_lock );
911+ mutex_lock ( & sdebug_host_list_mutex );
912912 list_for_each_entry (sdbg_host , & sdebug_host_list , host_list ) {
913913 hpnt = sdbg_host -> shost ;
914914 if ((hpnt -> this_id >= 0 ) &&
@@ -919,7 +919,7 @@ static void sdebug_max_tgts_luns(void)
919919 /* sdebug_max_luns; */
920920 hpnt -> max_lun = SCSI_W_LUN_REPORT_LUNS + 1 ;
921921 }
922- spin_unlock ( & sdebug_host_list_lock );
922+ mutex_unlock ( & sdebug_host_list_mutex );
923923}
924924
925925enum sdeb_cmd_data {SDEB_IN_DATA = 0 , SDEB_IN_CDB = 1 };
@@ -1051,14 +1051,14 @@ static void all_config_cdb_len(void)
10511051 struct Scsi_Host * shost ;
10521052 struct scsi_device * sdev ;
10531053
1054- spin_lock ( & sdebug_host_list_lock );
1054+ mutex_lock ( & sdebug_host_list_mutex );
10551055 list_for_each_entry (sdbg_host , & sdebug_host_list , host_list ) {
10561056 shost = sdbg_host -> shost ;
10571057 shost_for_each_device (sdev , shost ) {
10581058 config_cdb_len (sdev );
10591059 }
10601060 }
1061- spin_unlock ( & sdebug_host_list_lock );
1061+ mutex_unlock ( & sdebug_host_list_mutex );
10621062}
10631063
10641064static void clear_luns_changed_on_target (struct sdebug_dev_info * devip )
@@ -5423,15 +5423,15 @@ static int scsi_debug_host_reset(struct scsi_cmnd *SCpnt)
54235423 ++ num_host_resets ;
54245424 if (SDEBUG_OPT_ALL_NOISE & sdebug_opts )
54255425 sdev_printk (KERN_INFO , SCpnt -> device , "%s\n" , __func__ );
5426- spin_lock ( & sdebug_host_list_lock );
5426+ mutex_lock ( & sdebug_host_list_mutex );
54275427 list_for_each_entry (sdbg_host , & sdebug_host_list , host_list ) {
54285428 list_for_each_entry (devip , & sdbg_host -> dev_info_list ,
54295429 dev_list ) {
54305430 set_bit (SDEBUG_UA_BUS_RESET , devip -> uas_bm );
54315431 ++ k ;
54325432 }
54335433 }
5434- spin_unlock ( & sdebug_host_list_lock );
5434+ mutex_unlock ( & sdebug_host_list_mutex );
54355435 stop_all_queued ();
54365436 if (SDEBUG_OPT_RESET_NOISE & sdebug_opts )
54375437 sdev_printk (KERN_INFO , SCpnt -> device ,
@@ -6337,13 +6337,13 @@ static ssize_t lun_format_store(struct device_driver *ddp, const char *buf,
63376337 struct sdebug_host_info * sdhp ;
63386338 struct sdebug_dev_info * dp ;
63396339
6340- spin_lock ( & sdebug_host_list_lock );
6340+ mutex_lock ( & sdebug_host_list_mutex );
63416341 list_for_each_entry (sdhp , & sdebug_host_list , host_list ) {
63426342 list_for_each_entry (dp , & sdhp -> dev_info_list , dev_list ) {
63436343 set_bit (SDEBUG_UA_LUNS_CHANGED , dp -> uas_bm );
63446344 }
63456345 }
6346- spin_unlock ( & sdebug_host_list_lock );
6346+ mutex_unlock ( & sdebug_host_list_mutex );
63476347 }
63486348 return count ;
63496349 }
@@ -6373,7 +6373,7 @@ static ssize_t max_luns_store(struct device_driver *ddp, const char *buf,
63736373 struct sdebug_host_info * sdhp ;
63746374 struct sdebug_dev_info * dp ;
63756375
6376- spin_lock ( & sdebug_host_list_lock );
6376+ mutex_lock ( & sdebug_host_list_mutex );
63776377 list_for_each_entry (sdhp , & sdebug_host_list ,
63786378 host_list ) {
63796379 list_for_each_entry (dp , & sdhp -> dev_info_list ,
@@ -6382,7 +6382,7 @@ static ssize_t max_luns_store(struct device_driver *ddp, const char *buf,
63826382 dp -> uas_bm );
63836383 }
63846384 }
6385- spin_unlock ( & sdebug_host_list_lock );
6385+ mutex_unlock ( & sdebug_host_list_mutex );
63866386 }
63876387 return count ;
63886388 }
@@ -6489,7 +6489,7 @@ static ssize_t virtual_gb_store(struct device_driver *ddp, const char *buf,
64896489 struct sdebug_host_info * sdhp ;
64906490 struct sdebug_dev_info * dp ;
64916491
6492- spin_lock ( & sdebug_host_list_lock );
6492+ mutex_lock ( & sdebug_host_list_mutex );
64936493 list_for_each_entry (sdhp , & sdebug_host_list ,
64946494 host_list ) {
64956495 list_for_each_entry (dp , & sdhp -> dev_info_list ,
@@ -6498,7 +6498,7 @@ static ssize_t virtual_gb_store(struct device_driver *ddp, const char *buf,
64986498 dp -> uas_bm );
64996499 }
65006500 }
6501- spin_unlock ( & sdebug_host_list_lock );
6501+ mutex_unlock ( & sdebug_host_list_mutex );
65026502 }
65036503 return count ;
65046504 }
@@ -7258,9 +7258,9 @@ static int sdebug_add_host_helper(int per_host_idx)
72587258 goto clean ;
72597259 }
72607260
7261- spin_lock ( & sdebug_host_list_lock );
7261+ mutex_lock ( & sdebug_host_list_mutex );
72627262 list_add_tail (& sdbg_host -> host_list , & sdebug_host_list );
7263- spin_unlock ( & sdebug_host_list_lock );
7263+ mutex_unlock ( & sdebug_host_list_mutex );
72647264
72657265 sdbg_host -> dev .bus = & pseudo_lld_bus ;
72667266 sdbg_host -> dev .parent = pseudo_primary ;
@@ -7269,9 +7269,9 @@ static int sdebug_add_host_helper(int per_host_idx)
72697269
72707270 error = device_register (& sdbg_host -> dev );
72717271 if (error ) {
7272- spin_lock ( & sdebug_host_list_lock );
7272+ mutex_lock ( & sdebug_host_list_mutex );
72737273 list_del (& sdbg_host -> host_list );
7274- spin_unlock ( & sdebug_host_list_lock );
7274+ mutex_unlock ( & sdebug_host_list_mutex );
72757275 goto clean ;
72767276 }
72777277
@@ -7311,7 +7311,7 @@ static void sdebug_do_remove_host(bool the_end)
73117311 struct sdebug_host_info * sdbg_host = NULL ;
73127312 struct sdebug_host_info * sdbg_host2 ;
73137313
7314- spin_lock ( & sdebug_host_list_lock );
7314+ mutex_lock ( & sdebug_host_list_mutex );
73157315 if (!list_empty (& sdebug_host_list )) {
73167316 sdbg_host = list_entry (sdebug_host_list .prev ,
73177317 struct sdebug_host_info , host_list );
@@ -7336,7 +7336,7 @@ static void sdebug_do_remove_host(bool the_end)
73367336 }
73377337 if (sdbg_host )
73387338 list_del (& sdbg_host -> host_list );
7339- spin_unlock ( & sdebug_host_list_lock );
7339+ mutex_unlock ( & sdebug_host_list_mutex );
73407340
73417341 if (!sdbg_host )
73427342 return ;
0 commit comments