All of lore.kernel.org
 help / color / mirror / Atom feed
From: john.p.donnelly@oracle.com
To: Don Brace <don.brace@microchip.com>,
	hch@infradead.org, martin.petersen@oracle.com,
	jejb@linux.vnet.ibm.com, linux-scsi@vger.kernel.org
Cc: Kevin.Barnett@microchip.com, scott.teel@microchip.com,
	Justin.Lindley@microchip.com, scott.benesh@microchip.com,
	gerry.morong@microchip.com, mahesh.rajashekhara@microchip.com,
	mike.mcgowen@microchip.com, murthy.bhat@microchip.com,
	balsundar.p@microchip.com, joseph.szczypek@hpe.com,
	jeff@canonical.com, POSWALD@suse.com, mwilck@suse.com,
	pmenzel@molgen.mpg.de, linux-kernel@vger.kernel.org
Subject: Re: [smartpqi updates PATCH V2 01/11] smartpqi: update device removal management
Date: Thu, 30 Sep 2021 13:21:26 -0500	[thread overview]
Message-ID: <b3d91ad4-b3ea-d189-1606-d565166a4fe8@oracle.com> (raw)
In-Reply-To: <20210928235442.201875-2-don.brace@microchip.com>

On 9/28/21 6:54 PM, Don Brace wrote:
> Update device removal path to handle issues for:
>    rmmod - Correct stack trace when removing devices.
>    rmmod - Synchronize SCSI cache.
>    Update handling for removing devices using sysfs.
> 
> This patch also aligns the device removal code with
> our out-of-box driver.
> 
> Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
> Reviewed-by: Scott Teel <scott.teel@microchip.com>
> Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
> Signed-off-by: Don Brace <don.brace@microchip.com>

Acked-by: John Donnelly <john.p.donnelly@oracle.com>


> ---
>   drivers/scsi/smartpqi/smartpqi_init.c | 64 ++++++++++++---------------
>   1 file changed, 28 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
> index ecb2af3f43ca..97027574eb1f 100644
> --- a/drivers/scsi/smartpqi/smartpqi_init.c
> +++ b/drivers/scsi/smartpqi/smartpqi_init.c
> @@ -1693,8 +1693,6 @@ static inline void pqi_remove_device(struct pqi_ctrl_info *ctrl_info, struct pqi
>   {
>   	int rc;
>   
> -	pqi_device_remove_start(device);
> -
>   	rc = pqi_device_wait_for_pending_io(ctrl_info, device,
>   		PQI_REMOVE_DEVICE_PENDING_IO_TIMEOUT_MSECS);
>   	if (rc)
> @@ -1708,6 +1706,8 @@ static inline void pqi_remove_device(struct pqi_ctrl_info *ctrl_info, struct pqi
>   		scsi_remove_device(device->sdev);
>   	else
>   		pqi_remove_sas_device(device);
> +
> +	pqi_device_remove_start(device);
>   }
>   
>   /* Assumes the SCSI device list lock is held. */
> @@ -1986,7 +1986,7 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info,
>   	list_for_each_entry_safe(device, next, &ctrl_info->scsi_device_list,
>   		scsi_device_list_entry) {
>   		if (device->device_gone) {
> -			list_del_init(&device->scsi_device_list_entry);
> +			list_del(&device->scsi_device_list_entry);
>   			list_add_tail(&device->delete_list_entry, &delete_list);
>   		}
>   	}
> @@ -2025,15 +2025,13 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info,
>   		if (device->volume_offline) {
>   			pqi_dev_info(ctrl_info, "offline", device);
>   			pqi_show_volume_status(ctrl_info, device);
> -		}
> -		list_del(&device->delete_list_entry);
> -		if (pqi_is_device_added(device)) {
> -			pqi_remove_device(ctrl_info, device);
>   		} else {
> -			if (!device->volume_offline)
> -				pqi_dev_info(ctrl_info, "removed", device);
> -			pqi_free_device(device);
> +			pqi_dev_info(ctrl_info, "removed", device);
>   		}
> +		if (pqi_is_device_added(device))
> +			pqi_remove_device(ctrl_info, device);
> +		list_del(&device->delete_list_entry);
> +		pqi_free_device(device);
>   	}
>   
>   	/*
> @@ -2328,6 +2326,25 @@ static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info)
>   	return rc;
>   }
>   
> +static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info)
> +{
> +	unsigned long flags;
> +	struct pqi_scsi_dev *device;
> +	struct pqi_scsi_dev *next;
> +
> +	spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
> +
> +	list_for_each_entry_safe(device, next, &ctrl_info->scsi_device_list,
> +		scsi_device_list_entry) {
> +		if (pqi_is_device_added(device))
> +			pqi_remove_device(ctrl_info, device);
> +		list_del(&device->scsi_device_list_entry);
> +		pqi_free_device(device);
> +	}
> +
> +	spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
> +}
> +
>   static int pqi_scan_scsi_devices(struct pqi_ctrl_info *ctrl_info)
>   {
>   	int rc;
> @@ -6120,31 +6137,6 @@ static int pqi_slave_configure(struct scsi_device *sdev)
>   	return 0;
>   }
>   
> -static void pqi_slave_destroy(struct scsi_device *sdev)
> -{
> -	unsigned long flags;
> -	struct pqi_scsi_dev *device;
> -	struct pqi_ctrl_info *ctrl_info;
> -
> -	ctrl_info = shost_to_hba(sdev->host);
> -
> -	spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
> -
> -	device = sdev->hostdata;
> -	if (device) {
> -		sdev->hostdata = NULL;
> -		if (!list_empty(&device->scsi_device_list_entry))
> -			list_del(&device->scsi_device_list_entry);
> -	}
> -
> -	spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
> -
> -	if (device) {
> -		pqi_dev_info(ctrl_info, "removed", device);
> -		pqi_free_device(device);
> -	}
> -}
> -
>   static int pqi_getpciinfo_ioctl(struct pqi_ctrl_info *ctrl_info, void __user *arg)
>   {
>   	struct pci_dev *pci_dev;
> @@ -6938,7 +6930,6 @@ static struct scsi_host_template pqi_driver_template = {
>   	.ioctl = pqi_ioctl,
>   	.slave_alloc = pqi_slave_alloc,
>   	.slave_configure = pqi_slave_configure,
> -	.slave_destroy = pqi_slave_destroy,
>   	.map_queues = pqi_map_queues,
>   	.sdev_attrs = pqi_sdev_attrs,
>   	.shost_attrs = pqi_shost_attrs,
> @@ -8169,6 +8160,7 @@ static void pqi_remove_ctrl(struct pqi_ctrl_info *ctrl_info)
>   {
>   	pqi_cancel_rescan_worker(ctrl_info);
>   	pqi_cancel_update_time_worker(ctrl_info);
> +	pqi_remove_all_scsi_devices(ctrl_info);
>   	pqi_unregister_scsi(ctrl_info);
>   	if (ctrl_info->pqi_mode_enabled)
>   		pqi_revert_to_sis_mode(ctrl_info);
> 


  reply	other threads:[~2021-09-30 18:22 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 23:54 [smartpqi updates PATCH V2 00/11] smartpqi updates Don Brace
2021-09-28 23:54 ` [smartpqi updates PATCH V2 01/11] smartpqi: update device removal management Don Brace
2021-09-30 18:21   ` john.p.donnelly [this message]
2021-09-28 23:54 ` [smartpqi updates PATCH V2 02/11] smartpqi: add controller handshake during kdump Don Brace
2021-09-30 18:21   ` john.p.donnelly
2021-09-28 23:54 ` [smartpqi updates PATCH V2 03/11] smartpqi: capture controller reason codes Don Brace
2021-09-30 18:22   ` john.p.donnelly
2021-09-28 23:54 ` [smartpqi updates PATCH V2 04/11] smartpqi: update LUN reset handler Don Brace
2021-09-30 18:22   ` john.p.donnelly
2021-09-28 23:54 ` [smartpqi updates PATCH V2 05/11] smartpqi: add tur check for sanitize operation Don Brace
2021-09-29  7:56   ` Paul Menzel
2021-09-30 18:23   ` john.p.donnelly
2021-09-28 23:54 ` [smartpqi updates PATCH V2 06/11] smartpqi: avoid failing ios for offline devices Don Brace
2021-09-30 18:23   ` john.p.donnelly
2021-09-28 23:54 ` [smartpqi updates PATCH V2 07/11] smartpqi: add extended report physical luns Don Brace
2021-09-30 18:23   ` john.p.donnelly
2021-09-28 23:54 ` [smartpqi updates PATCH V2 08/11] smartpqi: fix boot failure during lun rebuild Don Brace
2021-09-30 18:24   ` john.p.donnelly
2021-09-28 23:54 ` [smartpqi updates PATCH V2 09/11] smartpqi: fix duplicate device nodes for tape changers Don Brace
2021-09-30 18:24   ` john.p.donnelly
2021-10-01  8:26   ` Paul Menzel
2021-10-05 20:23     ` Don.Brace
2021-10-06  2:37       ` Martin K. Petersen
2021-10-06 14:28         ` Don.Brace
2021-10-07  9:38       ` Paul Menzel
2021-09-28 23:54 ` [smartpqi updates PATCH V2 10/11] smartpqi: add 3252-8i pci id Don Brace
2021-09-30 18:24   ` john.p.donnelly
2021-09-28 23:54 ` [smartpqi updates PATCH V2 11/11] smartpqi: update version to 2.1.12-055 Don Brace
2021-09-30 18:25   ` john.p.donnelly
2021-09-29  9:34 ` [smartpqi updates PATCH V2 00/11] smartpqi updates Paul Menzel
2021-09-29 14:08   ` Don.Brace
2021-09-29 14:12     ` Paul Menzel
2021-10-12 20:35 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3d91ad4-b3ea-d189-1606-d565166a4fe8@oracle.com \
    --to=john.p.donnelly@oracle.com \
    --cc=Justin.Lindley@microchip.com \
    --cc=Kevin.Barnett@microchip.com \
    --cc=POSWALD@suse.com \
    --cc=balsundar.p@microchip.com \
    --cc=don.brace@microchip.com \
    --cc=gerry.morong@microchip.com \
    --cc=hch@infradead.org \
    --cc=jeff@canonical.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=joseph.szczypek@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mahesh.rajashekhara@microchip.com \
    --cc=martin.petersen@oracle.com \
    --cc=mike.mcgowen@microchip.com \
    --cc=murthy.bhat@microchip.com \
    --cc=mwilck@suse.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=scott.benesh@microchip.com \
    --cc=scott.teel@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.