Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1246811

Re: [PATCH 3/3] SCSI: Rework list handling in __scsi_target_remove

From Hannes Reinecke <hare@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] SCSI: Rework list handling in __scsi_target_remove
Date 2015-10-14 16:20 +0200
Message-ID <qjv4n-Wf-39@gated-at.bofh.it> (permalink)
References <qjuL0-k6-9@gated-at.bofh.it> <qjuL1-k6-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 10/14/2015 03:50 PM, Johannes Thumshirn wrote:
> Rework the list handling in __scsi_target_remove(). The new version introduces
> a reap list for devices. Devices that shall be removed are placed on the reap
> list and can then be removed later on.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  drivers/scsi/scsi_sysfs.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index b41dcb3..2bd88c6 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -1129,20 +1129,24 @@ static void __scsi_remove_target(struct scsi_target *starget)
>  {
>  	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
>  	unsigned long flags;
> -	struct scsi_device *sdev;
> +	struct scsi_device *sdev, *tmp;
> +	LIST_HEAD(reap_list);
>  
>  	spin_lock_irqsave(&shost->device_lock, flags);
>   restart:
> -	list_for_each_entry(sdev, &shost->__devices, siblings) {
> +	list_for_each_entry_safe(sdev, tmp, &shost->__devices, siblings) {
>  		if (sdev->channel != starget->channel ||
>  		    sdev->id != starget->id ||
>  		    scsi_device_get(sdev))
>  			continue;
> -		scsi_remove_device(sdev);
> +		list_move_tail(&sdev->siblings, &reap_list);
>  		scsi_device_put(sdev);
>  		goto restart;
>  	}
>  	spin_unlock_irqrestore(&shost->device_lock, flags);
> +
> +	list_for_each_entry_safe(sdev, tmp, &reap_list, siblings)
> +		scsi_remove_device(sdev);
>  }
>  
>  /**
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-14 16:00 +0200
  [PATCH 2/3] SCSI: Rework list handling in scsi_target_remove Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-14 16:00 +0200
    Re: [PATCH 2/3] SCSI: Rework list handling in scsi_target_remove Hannes Reinecke <hare@suse.de> - 2015-10-14 16:20 +0200
  [PATCH 3/3]  SCSI: Rework list handling in __scsi_target_remove Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-14 16:00 +0200
    Re: [PATCH 3/3]  SCSI: Rework list handling in __scsi_target_remove Hannes Reinecke <hare@suse.de> - 2015-10-14 16:20 +0200
  [PATCH 1/3] SCSI: Introduce device_lock and target_lock in Scsi_Host Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-14 16:00 +0200
    Re: [PATCH 1/3] SCSI: Introduce device_lock and target_lock in Scsi_Host Hannes Reinecke <hare@suse.de> - 2015-10-14 16:20 +0200
    Re: [PATCH 1/3] SCSI: Introduce device_lock and target_lock in Scsi_Host Hannes Reinecke <hare@suse.de> - 2015-10-14 16:20 +0200
  Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-14 16:40 +0200
    Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() James Bottomley <James.Bottomley@HansenPartnership.com> - 2015-10-14 17:50 +0200
      Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-14 19:40 +0200
      Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Christoph Hellwig <hch@infradead.org> - 2015-10-14 20:20 +0200
        Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-16 13:30 +0200
    Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Christoph Hellwig <hch@infradead.org> - 2015-10-14 18:20 +0200
      Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-14 19:40 +0200
  Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() James Bottomley <James.Bottomley@HansenPartnership.com> - 2015-10-14 16:40 +0200
    Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Ewan Milne <emilne@redhat.com> - 2015-10-14 22:30 +0200
      Re: [PATCH 0/3] SCSI: Fix hard lockup in scsi_remove_target() Johannes Thumshirn <jthumshirn@suse.de> - 2015-10-15 09:10 +0200

csiph-web