scsi_debug: take sdebug_host_list_lock when changing capacity All other traversals of the sdebug_host_list take the lock. Signed-off-by: Ewan D. Milne <emilne@redhat.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 2e32a4c..0d0e0593 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c
@@ -4438,6 +4438,7 @@ struct sdebug_host_info *sdhp; struct sdebug_dev_info *dp; + spin_lock(&sdebug_host_list_lock); list_for_each_entry(sdhp, &sdebug_host_list, host_list) { list_for_each_entry(dp, &sdhp->dev_info_list, @@ -4446,6 +4447,7 @@ dp->uas_bm); } } + spin_unlock(&sdebug_host_list_lock); } return count; }