|
@@ -1915,6 +1915,19 @@ static int afu_reset(struct cxlflash_cfg *cfg)
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * drain_ioctls() - wait until all currently executing ioctls have completed
|
|
|
+ * @cfg: Internal structure associated with the host.
|
|
|
+ *
|
|
|
+ * Obtain write access to read/write semaphore that wraps ioctl
|
|
|
+ * handling to 'drain' ioctls currently executing.
|
|
|
+ */
|
|
|
+static void drain_ioctls(struct cxlflash_cfg *cfg)
|
|
|
+{
|
|
|
+ down_write(&cfg->ioctl_rwsem);
|
|
|
+ up_write(&cfg->ioctl_rwsem);
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* cxlflash_eh_device_reset_handler() - reset a single LUN
|
|
|
* @scp: SCSI command to send.
|
|
@@ -1986,6 +1999,7 @@ static int cxlflash_eh_host_reset_handler(struct scsi_cmnd *scp)
|
|
|
switch (cfg->state) {
|
|
|
case STATE_NORMAL:
|
|
|
cfg->state = STATE_RESET;
|
|
|
+ drain_ioctls(cfg);
|
|
|
cxlflash_mark_contexts_error(cfg);
|
|
|
rcr = afu_reset(cfg);
|
|
|
if (rcr) {
|
|
@@ -2503,19 +2517,6 @@ out_remove:
|
|
|
goto out;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * drain_ioctls() - wait until all currently executing ioctls have completed
|
|
|
- * @cfg: Internal structure associated with the host.
|
|
|
- *
|
|
|
- * Obtain write access to read/write semaphore that wraps ioctl
|
|
|
- * handling to 'drain' ioctls currently executing.
|
|
|
- */
|
|
|
-static void drain_ioctls(struct cxlflash_cfg *cfg)
|
|
|
-{
|
|
|
- down_write(&cfg->ioctl_rwsem);
|
|
|
- up_write(&cfg->ioctl_rwsem);
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* cxlflash_pci_error_detected() - called when a PCI error is detected
|
|
|
* @pdev: PCI device struct.
|