]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: smartpqi: Update volume size after expansion
authorMahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Tue, 1 Feb 2022 21:48:38 +0000 (15:48 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 Feb 2022 04:38:35 +0000 (23:38 -0500)
After modifying logical volume size, lsblk command still shows previous
size of logical volume.

When the driver gets any event from firmware it schedules rescan worker
with delay of 10 seconds. If array expansion is so quick that it gets
completed in a second, the driver could not catch logical volume expansion
due to worker delay.

Since driver does not detect volume expansion, driver would not call
rescan device to update new size to the OS.

Link: https://lore.kernel.org/r/164375211833.440833.17023155389220583731.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/smartpqi/smartpqi.h
drivers/scsi/smartpqi/smartpqi_init.c

index 81ec5fbf570a77ce0e67adce905837c6ed0f6927..4f6e48854c6622835986b0611f134f975d4a022a 100644 (file)
@@ -1322,6 +1322,7 @@ struct pqi_ctrl_info {
        bool            controller_online;
        bool            block_requests;
        bool            scan_blocked;
+       u8              logical_volume_rescan_needed : 1;
        u8              inbound_spanning_supported : 1;
        u8              outbound_spanning_supported : 1;
        u8              pqi_mode_enabled : 1;
index ab12507da436774ae9b2aaca7968ade0c4a72cae..de53180fab9c3773c96a575cfd6709244e5189e6 100644 (file)
@@ -2015,8 +2015,8 @@ static void pqi_dev_info(struct pqi_ctrl_info *ctrl_info,
 
 /* Assumes the SCSI device list lock is held. */
 
-static void pqi_scsi_update_device(struct pqi_scsi_dev *existing_device,
-       struct pqi_scsi_dev *new_device)
+static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info,
+       struct pqi_scsi_dev *existing_device, struct pqi_scsi_dev *new_device)
 {
        existing_device->device_type = new_device->device_type;
        existing_device->bus = new_device->bus;
@@ -2026,9 +2026,8 @@ static void pqi_scsi_update_device(struct pqi_scsi_dev *existing_device,
                existing_device->target_lun_valid = true;
        }
 
-       if ((existing_device->volume_status == CISS_LV_QUEUED_FOR_EXPANSION ||
-               existing_device->volume_status == CISS_LV_UNDERGOING_EXPANSION) &&
-               new_device->volume_status == CISS_LV_OK)
+       if (pqi_is_logical_device(existing_device) &&
+               ctrl_info->logical_volume_rescan_needed)
                existing_device->rescan = true;
 
        /* By definition, the scsi3addr and wwid fields are already the same. */
@@ -2146,7 +2145,7 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info,
                         */
                        device->new_device = false;
                        matching_device->device_gone = false;
-                       pqi_scsi_update_device(matching_device, device);
+                       pqi_scsi_update_device(ctrl_info, matching_device, device);
                        break;
                case DEVICE_NOT_FOUND:
                        /*
@@ -2218,8 +2217,8 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info,
        }
 
        /*
-        * Notify the SCSI ML if the queue depth of any existing device has
-        * changed.
+        * Notify the SML of any existing device changes such as;
+        * queue depth, device size.
         */
        list_for_each_entry(device, &ctrl_info->scsi_device_list, scsi_device_list_entry) {
                if (device->sdev && device->queue_depth != device->advertised_queue_depth) {
@@ -2248,6 +2247,9 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info,
                        }
                }
        }
+
+       ctrl_info->logical_volume_rescan_needed = false;
+
 }
 
 static inline bool pqi_is_supported_device(struct pqi_scsi_dev *device)
@@ -3703,6 +3705,8 @@ static void pqi_event_worker(struct work_struct *work)
                        } else {
                                ack_event = true;
                                rescan_needed = true;
+                               if (event->event_type == PQI_EVENT_TYPE_LOGICAL_DEVICE)
+                                       ctrl_info->logical_volume_rescan_needed = true;
                        }
                        if (ack_event)
                                pqi_acknowledge_event(ctrl_info, event);